diff options
| author | gingerBill <bill+github@gingerbill.org> | 2016-08-10 20:05:45 +0100 |
|---|---|---|
| committer | gingerBill <bill+github@gingerbill.org> | 2016-08-10 20:07:24 +0100 |
| commit | 4c467b118d12ca6fabd018e4c0295096fa4d399b (patch) | |
| tree | bc0ce39d34805d32b736ac2c37a38dd42202dbcb /src/checker/expr.cpp | |
| parent | 153c27c7556ebef0c98055d87937b942d198f629 (diff) | |
copy(...)
Diffstat (limited to 'src/checker/expr.cpp')
| -rw-r--r-- | src/checker/expr.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/checker/expr.cpp b/src/checker/expr.cpp index d39c86ee0..2fc55a294 100644 --- a/src/checker/expr.cpp +++ b/src/checker/expr.cpp @@ -1553,6 +1553,7 @@ ExpressionKind check_call_expr(Checker *c, Operand *operand, AstNode *call) { return Expression_Statement; } + if (operand->mode == Addressing_Builtin) { i32 id = operand->builtin_id; if (!check_builtin_procedure(c, operand, call, id)) @@ -1574,6 +1575,17 @@ ExpressionKind check_call_expr(Checker *c, Operand *operand, AstNode *call) { return Expression_Statement; } + if (curr_procedure(c) == NULL) { + AstNode *e = operand->expr; + gbString str = expr_to_string(e); + defer (gb_string_free(str)); + error(&c->error_collector, ast_node_token(e), "Can ony call procedure within a procedure: `%s`", str); + + operand->mode = Addressing_Invalid; + operand->expr = call; + + return Expression_Statement; + } check_call_arguments(c, operand, proc_type, call); |