From 5fe4c33d0e71250bcedde0bfada91aab75c640ab Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 17 Jun 2018 21:46:37 +0100 Subject: Allow importation of `core:builtin` to get built-in entities --- src/check_expr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/check_expr.cpp') diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 382cf1020..ada8a177d 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -44,7 +44,6 @@ int valid_index_and_score_cmp(void const *a, void const *b) { - #define CALL_ARGUMENT_CHECKER(name) CallArgumentError name(CheckerContext *c, Ast *call, Type *proc_type, Entity *entity, Array operands, CallArgumentErrorMode show_error_mode, CallArgumentData *data) typedef CALL_ARGUMENT_CHECKER(CallArgumentCheckerType); @@ -5206,6 +5205,10 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type case_ast_node(bl, BasicLit, node); + // NOTE(bill, 2018-06-17): Placing this in the parser is slower than + // placing it here for some reason. So don't move it to the parsing + // stage if you _think_ it will be faster, only do it if you _know_ it + // will be faster. Type *t = t_invalid; switch (bl->token.kind) { case Token_Integer: t = t_untyped_integer; break; @@ -5231,6 +5234,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type case_end; case_ast_node(bd, BasicDirective, node); + o->mode = Addressing_Constant; if (bd->name == "file") { o->type = t_untyped_string; o->value = exact_value_string(bd->token.pos.file); @@ -5254,7 +5258,6 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type } else { GB_PANIC("Unknown basic directive"); } - o->mode = Addressing_Constant; case_end; case_ast_node(pg, ProcGroup, node); @@ -5296,7 +5299,6 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type } check_close_scope(&ctx); - o->mode = Addressing_Value; o->type = type; case_end; -- cgit v1.2.3