Skip to content

Commit 081a3fc

Browse files
committed
Added check for valid RECORD when initializing a variable
1 parent c94e353 commit 081a3fc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

grammar.y

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ Stmnt : EOL { $$ = new Empty; prev->link($$); prev = $$; }
204204
}
205205
}
206206
| ID ASSIGN ID LCURL Args RCURL EOL {
207+
if (!table->check($3).first || table->type($3) != ExpI::RecordT) {
208+
error(@1, "no such record: " + $3);
209+
YYERROR;
210+
}
207211
if ($5.size() != std::get<RecordT>(table->value($3)).size()) {
208212
error(@2, "wrong number of fields for record type: " + $3);
209213
YYERROR;

0 commit comments

Comments
 (0)