Give bool a size and insert the types in the order they're defined in.
Module *module = new Module(parser.parse(*io, "<builtin>", BUILTIN_SOURCE));
NodeList<Statement> &shared_body = module->shared.content.body;
Module *module = new Module(parser.parse(*io, "<builtin>", BUILTIN_SOURCE));
NodeList<Statement> &shared_body = module->shared.content.body;
+ NodeList<Statement>::iterator insert_point = shared_body.begin();
RefPtr<BasicTypeDeclaration> type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "void";
type->kind = BasicTypeDeclaration::VOID;
RefPtr<BasicTypeDeclaration> type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "void";
type->kind = BasicTypeDeclaration::VOID;
- shared_body.insert(shared_body.begin(), type);
+ shared_body.insert(insert_point, type);
type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "bool";
type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "bool";
type->kind = BasicTypeDeclaration::BOOL;
type->kind = BasicTypeDeclaration::BOOL;
- shared_body.insert(shared_body.begin(), type);
+ shared_body.insert(insert_point, type);
type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "int";
type->size = 32;
type->kind = BasicTypeDeclaration::INT;
type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "int";
type->size = 32;
type->kind = BasicTypeDeclaration::INT;
- shared_body.insert(shared_body.begin(), type);
+ shared_body.insert(insert_point, type);
type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "float";
type->size = 32;
type->kind = BasicTypeDeclaration::FLOAT;
type = new BasicTypeDeclaration;
type->source = BUILTIN_SOURCE;
type->name = "float";
type->size = 32;
type->kind = BasicTypeDeclaration::FLOAT;
- shared_body.insert(shared_body.begin(), type);
+ shared_body.insert(insert_point, type);
TypeResolver().apply(module->shared);
for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
TypeResolver().apply(module->shared);
for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)