summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-07-03 16:09:10 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-07-03 16:09:10 -0400
commit119950ebde3c9f096d1866ba6448d6bd9b22d063 (patch)
tree35e6bb7a2507910ac784356baf25c2412b6959b6 /eval.c
parentb25f392b221cea498ea7695f68828909734b51cd (diff)
removed ability to evaluate a function before it is declared at compile time; that was causing too many problems
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 1bbea0d..e4b5313 100644
--- a/eval.c
+++ b/eval.c
@@ -1023,7 +1023,9 @@ static Status eval_ident(Evaluator *ev, Identifier ident, Value *v, Location whe
v->type->kind = TYPE_STRUCT;
v->type->struc = d->expr.typeval->struc;
return true;
+ } else if (d->flags & DECL_FOUND_TYPE) {
} else {
+ #if 0
Typer *tr = ev->typer;
Block *prev_block = tr->block;
/* make sure we're in the right block for typing the declaration */
@@ -1032,6 +1034,10 @@ static Status eval_ident(Evaluator *ev, Identifier ident, Value *v, Location whe
tr->block = prev_block;
if (!success) return false;
assert(d->type.flags & TYPE_IS_RESOLVED);
+ #else
+ err_print(where, "Use of identifier at compile time before it is declared. This isn't allowed. Sorry.");
+ return false;
+ #endif
}
Value *ival = ident_val(ev, ident, where);
if (!ival) return false;
@@ -1691,6 +1697,9 @@ static Status eval_stmt(Evaluator *ev, Statement *stmt) {
case STMT_BLOCK:
if (!eval_block(ev, stmt->block)) return false;
break;
+ case STMT_INCLUDE:
+ assert(0);
+ break;
}
return true;
}