Add enum type info and fix enum casting

This commit is contained in:
Ginger Bill
2017-01-01 16:58:38 +00:00
parent 6fef74317c
commit 311b5cb6e2
11 changed files with 178 additions and 193 deletions
+2 -3
View File
@@ -848,7 +848,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
tt = make_type_pointer(c->allocator, case_type);
add_type_info_type(c, tt);
}
Entity *tag_var = make_entity_variable(c->allocator, c->context.scope, ms->var->Ident, tt, false);
Entity *tag_var = make_entity_variable(c->allocator, c->context.scope, ms->var->Ident, tt);
tag_var->flags |= EntityFlag_Used;
add_entity(c, c->context.scope, ms->var, tag_var);
add_entity_use(c, ms->var, tag_var);
@@ -1106,7 +1106,6 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
case_end;
case_ast_node(vs, ValueSpec, spec);
switch (vs->keyword) {
case Token_let:
case Token_var: {
isize entity_count = vs->names.count;
isize entity_index = 0;
@@ -1124,7 +1123,7 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
found = current_scope_lookup_entity(c->context.scope, str);
}
if (found == NULL) {
entity = make_entity_variable(c->allocator, c->context.scope, token, NULL, vs->keyword == Token_let);
entity = make_entity_variable(c->allocator, c->context.scope, token, NULL);
add_entity_definition(&c->info, name, entity);
} else {
TokenPos pos = found->token.pos;