if (lhs_type == rhs_type)
return rhs_tree;
- if (lhs_type->is_error_type() || rhs_type->is_error_type())
+ if (lhs_type->is_error() || rhs_type->is_error())
return error_mark_node;
- if (lhs_type->is_undefined() || rhs_type->is_undefined())
- {
- // Make sure we report the error.
- lhs_type->base();
- rhs_type->base();
- return error_mark_node;
- }
-
if (rhs_tree == error_mark_node || TREE_TYPE(rhs_tree) == error_mark_node)
return error_mark_node;
void
Const_expression::check_for_init_loop()
{
- if (this->type_ != NULL && this->type_->is_error_type())
+ if (this->type_ != NULL && this->type_->is_error())
return;
if (this->seen_)
if (find_named_object.found())
{
- if (this->type_ == NULL || !this->type_->is_error_type())
+ if (this->type_ == NULL || !this->type_->is_error())
{
this->report_error(_("constant refers to itself"));
this->type_ = Type::make_error_type();
void
Const_expression::do_check_types(Gogo*)
{
- if (this->type_ != NULL && this->type_->is_error_type())
+ if (this->type_ != NULL && this->type_->is_error())
return;
this->check_for_init_loop();
Type* expr_type = this->expr_->type();
std::string reason;
- if (type->is_error_type()
- || type->is_undefined()
- || expr_type->is_error_type()
- || expr_type->is_undefined())
+ if (type->is_error() || expr_type->is_error())
{
- // Make sure we emit an error for an undefined type.
- type->base();
- expr_type->base();
this->set_is_error();
return;
}
Unary_expression::do_check_types(Gogo*)
{
Type* type = this->expr_->type();
- if (type->is_error_type())
+ if (type->is_error())
{
this->set_is_error();
return;
{
Type* left_type = this->left_->type();
Type* right_type = this->right_->type();
- if (left_type->is_error_type())
+ if (left_type->is_error())
return left_type;
- else if (right_type->is_error_type())
+ else if (right_type->is_error())
return right_type;
else if (!Type::are_compatible_for_binop(left_type, right_type))
{
Type* left_type = this->left_->type();
Type* right_type = this->right_->type();
- if (left_type->is_error_type() || right_type->is_error_type())
+ if (left_type->is_error() || right_type->is_error())
{
this->set_is_error();
return;
if (arg == NULL)
return false;
Type* arg_type = arg->type();
- if (arg_type->is_error_type() || arg_type->is_undefined())
+ if (arg_type->is_error())
return false;
if (arg_type->is_abstract())
return false;
return false;
}
if (args->front()->is_error_expression()
- || args->front()->type()->is_error_type()
- || args->front()->type()->is_undefined())
+ || args->front()->type()->is_error())
{
this->set_is_error();
return false;
arg_type = arg_type->points_to();
if (this->code_ == BUILTIN_CAP)
{
- if (!arg_type->is_error_type()
+ if (!arg_type->is_error()
&& arg_type->array_type() == NULL
&& arg_type->channel_type() == NULL)
this->report_error(_("argument must be array or slice "
}
else
{
- if (!arg_type->is_error_type()
+ if (!arg_type->is_error()
&& !arg_type->is_string_type()
&& arg_type->array_type() == NULL
&& arg_type->map_type() == NULL
++p)
{
Type* type = (*p)->type();
- if (type->is_error_type()
+ if (type->is_error()
|| type->is_string_type()
|| type->integer_type() != NULL
|| type->float_type() != NULL
}
Type* arg1_type = args->front()->type();
Type* arg2_type = args->back()->type();
- if (arg1_type->is_error_type() || arg2_type->is_error_type())
+ if (arg1_type->is_error() || arg2_type->is_error())
break;
Type* e1;
else if (args->size() > 2)
this->report_error(_("too many arguments"));
else if (args->front()->is_error_expression()
- || args->front()->type()->is_error_type()
+ || args->front()->type()->is_error()
|| args->back()->is_error_expression()
- || args->back()->type()->is_error_type())
+ || args->back()->type()->is_error())
this->set_is_error();
else if (!Type::are_identical(args->front()->type(),
args->back()->type(), true, NULL))
Function_type* fntype = this->get_function_type();
if (fntype == NULL)
{
- if (!this->fn_->type()->is_error_type())
+ if (!this->fn_->type()->is_error())
this->report_error(_("expected function"));
return;
}
Expression* end = this->end_;
Type* type = left->type();
- if (type->is_error_type())
+ if (type->is_error())
return Expression::make_error(location);
else if (left->is_type_expression())
{
Array_type* array_type = this->array_->type()->array_type();
if (array_type == NULL)
{
- gcc_assert(this->array_->type()->is_error_type());
+ gcc_assert(this->array_->type()->is_error());
return;
}
Array_type* array_type = this->array_->type()->array_type();
if (array_type == NULL)
{
- gcc_assert(this->array_->type()->is_error_type());
+ gcc_assert(this->array_->type()->is_error());
return error_mark_node;
}
Field_reference_expression::do_type()
{
Type* type = this->expr_->type();
- if (type->is_error_type())
+ if (type->is_error())
return type;
Struct_type* struct_type = type->struct_type();
gcc_assert(struct_type != NULL);
Field_reference_expression::do_check_types(Gogo*)
{
Type* type = this->expr_->type();
- if (type->is_error_type())
+ if (type->is_error())
return;
Struct_type* struct_type = type->struct_type();
gcc_assert(struct_type != NULL);
Array_type* array_type = this->type()->array_type();
if (array_type == NULL)
{
- gcc_assert(this->type()->is_error_type());
+ gcc_assert(this->type()->is_error());
return error_mark_node;
}
type = type->map_type()->val_type();
else
{
- if (!type->is_error_type())
+ if (!type->is_error())
error_at(this->location(),
("may only omit types within composite literals "
"of slice, array, or map type"));
}
}
- if (type->is_error_type())
+ if (type->is_error())
return Expression::make_error(this->location());
else if (type->struct_type() != NULL)
return this->lower_struct(gogo, type);
}
else if (expr_type->interface_type() == NULL)
{
- if (!expr_type->is_error_type() && !this->type_->is_error_type())
+ if (!expr_type->is_error() && !this->type_->is_error())
this->report_error(_("type assertion only valid for interface types"));
this->set_is_error();
}
if (!expr_type->interface_type()->implements_interface(this->type_,
&reason))
{
- if (!this->type_->is_error_type())
+ if (!this->type_->is_error())
{
if (reason.empty())
this->report_error(_("impossible type assertion: "
Receive_expression::do_check_types(Gogo*)
{
Type* type = this->channel_->type();
- if (type->is_error_type())
+ if (type->is_error())
{
this->set_is_error();
return;
Channel_type* channel_type = this->channel_->type()->channel_type();
if (channel_type == NULL)
{
- gcc_assert(this->channel_->type()->is_error_type());
+ gcc_assert(this->channel_->type()->is_error());
return error_mark_node;
}
Type* element_type = channel_type->element_type();
&& this->lhs_->map_index_expression() == NULL
&& !this->lhs_->is_sink_expression())
{
- if (!this->lhs_->type()->is_error_type())
+ if (!this->lhs_->type()->is_error())
this->report_error(_("invalid left hand side of assignment"));
return;
}
this->set_is_error();
}
- if (lhs_type->is_error_type()
- || rhs_type->is_error_type()
- || lhs_type->is_undefined()
- || rhs_type->is_undefined())
- {
- // Make sure we get the error for an undefined type.
- lhs_type->base();
- rhs_type->base();
- this->set_is_error();
- }
+ if (lhs_type->is_error() || rhs_type->is_error())
+ this->set_is_error();
}
// Build a tree for an assignment statement.
gcc_assert(prhs != this->rhs_->end());
if ((*plhs)->is_error_expression()
- || (*plhs)->type()->is_error_type()
+ || (*plhs)->type()->is_error()
|| (*prhs)->is_error_expression()
- || (*prhs)->type()->is_error_type())
+ || (*prhs)->type()->is_error())
continue;
if ((*plhs)->is_sink_expression())
++plhs, ++prhs)
{
if ((*plhs)->is_error_expression()
- || (*plhs)->type()->is_error_type()
+ || (*plhs)->type()->is_error()
|| (*prhs)->is_error_expression()
- || (*prhs)->type()->is_error_type())
+ || (*prhs)->type()->is_error())
continue;
if ((*plhs)->is_sink_expression())
Type* expr_type = this->expr_->type();
if (expr_type->interface_type() == NULL)
{
- if (!expr_type->is_error_type() && !this->type_->is_error_type())
+ if (!expr_type->is_error() && !this->type_->is_error())
this->report_error(_("type assertion only valid for interface types"));
return Statement::make_error_statement(loc);
}
i, reason.c_str());
this->set_is_error();
}
- else if (pt->type()->is_error_type()
- || (*pe)->type()->is_error_type()
- || pt->type()->is_undefined()
- || (*pe)->type()->is_undefined())
- {
- // Make sure we get the error for an undefined type.
- pt->type()->base();
- (*pe)->type()->base();
- this->set_is_error();
- }
+ else if (pt->type()->is_error() || (*pe)->type()->is_error())
+ this->set_is_error();
}
if (pt != results->end())
If_statement::do_check_types(Gogo*)
{
Type* type = this->cond_->type();
- if (type->is_error_type())
+ if (type->is_error())
this->set_is_error();
else if (!type->is_boolean_type())
this->report_error(_("expected boolean expression"));
If_statement::do_get_tree(Translate_context* context)
{
gcc_assert(this->cond_->type()->is_boolean_type()
- || this->cond_->type()->is_error_type());
+ || this->cond_->type()->is_error());
tree cond_tree = this->cond_->get_tree(context);
tree then_tree = this->then_block_->get_tree(context);
tree else_tree = (this->else_block_ == NULL
if (this->val_ != NULL
&& (this->val_->is_error_expression()
- || this->val_->type()->is_error_type()))
+ || this->val_->type()->is_error()))
return Statement::make_error_statement(loc);
if (this->val_ != NULL
Send_statement::do_check_types(Gogo*)
{
Type* type = this->channel_->type();
- if (type->is_error_type())
+ if (type->is_error())
{
this->set_is_error();
return;
index_type = range_type->channel_type()->element_type();
if (this->value_var_ != NULL)
{
- if (!this->value_var_->type()->is_error_type())
+ if (!this->value_var_->type()->is_error())
this->report_error(_("too many variables for range clause "
"with channel"));
return Statement::make_error_statement(this->location());