On error there is no need to pop the scope.

The error routines for task and function definitions were incorrectly
popping the scope. This should not be done since no scope was pushed.
Also assert that the current_task/function is 0 to catch that kind of
error like the other definition rules.
This commit is contained in:
Cary R 2010-06-13 11:41:24 -07:00 committed by Stephen Williams
parent 263dff6fbe
commit 07ee2e7dff
2 changed files with 3 additions and 4 deletions

View File

@ -2377,8 +2377,7 @@ module_item
| K_task automatic_opt IDENTIFIER error K_endtask
{
pform_pop_scope();
current_task = 0;
assert(current_task == 0);
delete[]$3;
}
@ -2418,8 +2417,7 @@ module_item
}
| K_function automatic_opt function_range_or_type_opt IDENTIFIER error K_endfunction
{
pform_pop_scope();
current_task = 0;
assert(current_function == 0);
delete[]$4;
}

View File

@ -262,6 +262,7 @@ static LexicalScope* lexical_scope = 0;
void pform_pop_scope()
{
assert(lexical_scope);
lexical_scope = lexical_scope->parent_scope();
}