-19f0ec56bf278a9cbb100c6b24ec1a12c95ec41a
+bc4dda16f8686ab6e7335adfdfd2c6cc81cb2eb5
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
{
Check_types_traverse traverse(this);
this->traverse(&traverse);
+
+ Bindings* bindings = this->current_bindings();
+ for (Bindings::const_declarations_iterator p = bindings->begin_declarations();
+ p != bindings->end_declarations();
+ ++p)
+ {
+ // Also check the types in a function declaration's signature.
+ Named_object* no = p->second;
+ if (no->is_function_declaration())
+ no->func_declaration_value()->check_types();
+ }
}
// Check the types in a single block.
}
}
+// Check that the types used in this declaration's signature are defined.
+// Reports errors for any undefined type.
+
+void
+Function_declaration::check_types() const
+{
+ // Calling Type::base will give errors for any undefined types.
+ Function_type* fntype = this->type();
+ if (fntype->receiver() != NULL)
+ fntype->receiver()->type()->base();
+ if (fntype->parameters() != NULL)
+ {
+ const Typed_identifier_list* params = fntype->parameters();
+ for (Typed_identifier_list::const_iterator p = params->begin();
+ p != params->end();
+ ++p)
+ p->type()->base();
+ }
+}
+
// Return the function's decl after it has been built.
Bfunction*
export_func(Export* exp, const std::string& name) const
{ Function::export_func_with_type(exp, name, this->fntype_); }
+ // Check that the types used in this declaration's signature are defined.
+ void
+ check_types() const;
+
private:
// The type of the function.
Function_type* fntype_;