Block* retblock = new Block(enclosing, loc);
retblock->set_end_location(loc);
- Temporary_statement* ts = Statement::make_temporary(Type::make_boolean_type(),
+ Temporary_statement* ts = Statement::make_temporary(Type::lookup_bool_type(),
left, loc);
retblock->add_statement(ts);
++count;
std::string can_recover_name = buf;
new_params->push_back(Typed_identifier(can_recover_name,
- Type::make_boolean_type(),
+ Type::lookup_bool_type(),
orig_fntype->location()));
const Typed_identifier_list* orig_results = orig_fntype->results();
// Add the can_recover argument to the (now) new bindings, and
// attach it to any recover statements.
- Variable* can_recover_var = new Variable(Type::make_boolean_type(), NULL,
+ Variable* can_recover_var = new Variable(Type::lookup_bool_type(), NULL,
false, true, false, location);
can_recover_no = new_bindings->add_variable(can_recover_name, NULL,
can_recover_var);
Typed_identifier_list* param_types = new Typed_identifier_list();
Type* voidptr_type = Type::make_pointer_type(Type::make_void_type());
param_types->push_back(Typed_identifier("a", voidptr_type, bloc));
- Type* boolean_type = Type::make_boolean_type();
+ Type* boolean_type = Type::lookup_bool_type();
Typed_identifier_list* results = new Typed_identifier_list();
results->push_back(Typed_identifier("", boolean_type, bloc));
Function_type* fntype = Type::make_function_type(NULL, param_types,
is_address_taken_(false), seen_(false), init_is_lowered_(false),
type_from_init_tuple_(false), type_from_range_index_(false),
type_from_range_value_(false), type_from_chan_element_(false),
- is_type_switch_var_(false)
+ is_type_switch_var_(false), determined_type_(false)
{
gcc_assert(type != NULL || init != NULL);
gcc_assert(!is_parameter || init == NULL);
void
Variable::determine_type()
{
+ if (this->determined_type_)
+ return;
+ this->determined_type_ = true;
+
if (this->preinit_ != NULL)
this->preinit_->determine_types();
param_types->push_back(Typed_identifier("val", pval_type, bloc));
Typed_identifier_list* ret_types = new Typed_identifier_list();
- ret_types->push_back(Typed_identifier("", Type::make_boolean_type(), bloc));
+ ret_types->push_back(Typed_identifier("", Type::lookup_bool_type(), bloc));
Function_type* fntype = Type::make_function_type(NULL, param_types,
ret_types, bloc);
// we add an argument when building recover thunks. Handle that
// here.
fields->push_back(Struct_field(Typed_identifier("can_recover",
- Type::make_boolean_type(),
+ Type::lookup_bool_type(),
location)));
}
// return value, to disable tail call optimizations which will
// break the way we check whether recover is permitted.
thunk_results = new Typed_identifier_list();
- thunk_results->push_back(Typed_identifier("", Type::make_boolean_type(),
+ thunk_results->push_back(Typed_identifier("", Type::lookup_bool_type(),
location));
}
Typed_identifier_list* result_types = new Typed_identifier_list();
result_types->push_back(Typed_identifier("",
- Type::make_boolean_type(),
+ Type::lookup_bool_type(),
bloc));
Function_type* t = Type::make_function_type(NULL, param_types,