#import "" as namespace

This commit is contained in:
Ginger Bill
2016-09-14 19:35:13 +01:00
parent bb109b47d6
commit 79f575ae8e
12 changed files with 322 additions and 275 deletions
+19 -1
View File
@@ -9,6 +9,7 @@ enum BuiltinProcId;
ENTITY_KIND(TypeName), \
ENTITY_KIND(Procedure), \
ENTITY_KIND(Builtin), \
ENTITY_KIND(ImportName), \
ENTITY_KIND(Count),
@@ -49,11 +50,19 @@ struct Entity {
i32 field_index; // Order in source
b8 is_field; // Is struct field
} Variable;
struct {} TypeName;
struct {
struct DeclInfo *decl; // Usually NULL
} TypeName;
struct {
b8 pure;
} Procedure;
struct { BuiltinProcId id; } Builtin;
struct {
String path;
String name;
Scope *scope;
b32 used;
} ImportName;
};
};
@@ -124,6 +133,15 @@ Entity *make_entity_builtin(gbAllocator a, Scope *scope, Token token, Type *type
return entity;
}
Entity *make_entity_import_name(gbAllocator a, Scope *scope, Token token, Type *type,
String path, String name, Scope *import_scope) {
Entity *entity = alloc_entity(a, Entity_ImportName, scope, token, type);
entity->ImportName.path = path;
entity->ImportName.name = name;
entity->ImportName.scope = import_scope;
return entity;
}
Entity *make_entity_dummy_variable(gbAllocator a, Scope *file_scope, Token token) {
token.string = make_string("_");
return make_entity_variable(a, file_scope, token, NULL);