copy(...)

This commit is contained in:
gingerBill
2016-08-10 20:07:24 +01:00
parent 153c27c755
commit 4c467b118d
10 changed files with 710 additions and 337 deletions
+8
View File
@@ -522,6 +522,14 @@ void pop_procedure(Checker *c) {
gb_array_pop(c->proc_stack);
}
Type *const curr_procedure(Checker *c) {
isize count = gb_array_count(c->proc_stack);
if (count > 0) {
return c->proc_stack[count-1];
}
return NULL;
}
void add_curr_ast_file(Checker *c, AstFile *file) {
TokenPos zero_pos = {};
c->error_collector.prev = zero_pos;
+12
View File
@@ -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);