Commit a570dd26 by Andrew Dahl

ref #15 Changed declaration check to include parent tables

parent 347091c9
Showing with 2 additions and 2 deletions
......@@ -157,7 +157,7 @@ stat: OUTPUT additive_exp NEWLINE {
}
}
| ID EQUALS assignment_exp NEWLINE {
if(symbol_table->at(level)->ExistsInCurrentLevel($1)) {
if(symbol_table->at(level)->Find($1) != NULL) {
Symbol* temp = symbol_table->at(level)->Insert(new Symbol($1, Symbol::VARIABLE, $3->getReturnType()));
if(temp->getType() == Symbol::FUNCTION) {
yyerror(symbol_table, instructions, "Function used like variable!");
......
......@@ -7,7 +7,7 @@ function int count(int num) {
function float fcount(float fnum) {
if fnum then {
output fcount(fnum - 1)
fnum = fcount(fnum - 1)
}
return fnum
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment