aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-10-29 15:46:23 +0000
committergingerBill <bill@gingerbill.org>2017-10-29 15:46:23 +0000
commit1eb9994d88b874b2f4ac3fdc4d314b1e67fa511b (patch)
tree5dd176e7f4e8677ea935762e7044a4d6e3265520 /src/checker.cpp
parenta43b89f36e988df8268ee92ea54017806b3226bb (diff)
Attributes; @(link_name="foo")
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index d6bbf754d..35744585a 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -182,6 +182,7 @@ struct DeclInfo {
AstNode * type_expr;
AstNode * init_expr;
Array<AstNode *> init_expr_list;
+ Array<AstNode *> attributes;
AstNode * proc_lit; // AstNode_ProcLit
Type * gen_proc_type; // Precalculated
@@ -1720,11 +1721,14 @@ void init_preload(Checker *c) {
{
String _global = str_lit("_global");
- Entity *e = make_entity_import_name(c->allocator, c->global_scope->parent, make_token_ident(_global), t_invalid,
+ Entity *type_info_entity = find_core_entity(c, str_lit("Type_Info"));
+ Scope *preload_scope = type_info_entity->scope;
+
+ Entity *e = make_entity_import_name(c->allocator, preload_scope, make_token_ident(_global), t_invalid,
str_lit(""), _global,
- c->global_scope);
+ preload_scope);
- add_entity(c, c->global_scope, nullptr, e);
+ add_entity(c, universal_scope, nullptr, e);
}
c->done_preload = true;
@@ -1999,6 +2003,7 @@ void check_collect_value_decl(Checker *c, AstNode *decl) {
d->type_expr = vd->type;
d->init_expr = init_expr;
}
+ d->attributes = vd->attributes;
add_entity_and_decl_info(c, name, e, d);
}
@@ -2028,6 +2033,8 @@ void check_collect_value_decl(Checker *c, AstNode *decl) {
DeclInfo *d = make_declaration_info(c->allocator, c->context.scope, c->context.decl);
Entity *e = nullptr;
+ d->attributes = vd->attributes;
+
if (is_ast_node_type(init) ||
(vd->type != nullptr && vd->type->kind == AstNode_TypeType)) {
e = make_entity_type_name(c->allocator, d->scope, token, nullptr);
@@ -2069,6 +2076,7 @@ void check_collect_value_decl(Checker *c, AstNode *decl) {
}
}
+
add_entity_and_decl_info(c, name, e, d);
}