-17325c96ccbee4ad6bed1cd3d9517f7dfbdf3ea7
+65eaa9003db4effc9c5ffe9c955e9534ba5d7d15
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
if (this->seen_ || nc->lowering())
{
- this->report_error(_("constant refers to itself"));
+ if (nc->type() == NULL || !nc->type()->is_error_type())
+ {
+ Location loc = this->location();
+ if (!this->seen_)
+ loc = nc->location();
+ go_error_at(loc, "constant refers to itself");
+ }
+ this->set_is_error();
this->type_ = Type::make_error_type();
+ nc->set_type(this->type_);
return this->type_;
}
this->seen_ = false;
+ if (ret->is_error_type())
+ nc->set_type(ret);
+
return ret;
}
return TRAVERSE_EXIT;
*pexpr = enew;
}
+
+ // Lower the type of this expression before the parent looks at it,
+ // in case the type contains an array that has expressions in its
+ // length. Skip an Unknown_expression, as at this point that means
+ // a composite literal key that does not have a type.
+ if ((*pexpr)->unknown_expression() == NULL)
+ Type::traverse((*pexpr)->type(), this);
+
return TRAVERSE_SKIP_COMPONENTS;
}
// Class Named_constant.
+// Set the type of a named constant. This is only used to set the
+// type to an error type.
+
+void
+Named_constant::set_type(Type* t)
+{
+ go_assert(this->type_ == NULL || t->is_error_type());
+ this->type_ = t;
+}
+
// Traverse the initializer expression.
int