diff --git a/parse.y b/parse.y index 4546195af..382f64cf2 100644 --- a/parse.y +++ b/parse.y @@ -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; } diff --git a/pform.cc b/pform.cc index 753626b0e..973f52c70 100644 --- a/pform.cc +++ b/pform.cc @@ -262,6 +262,7 @@ static LexicalScope* lexical_scope = 0; void pform_pop_scope() { + assert(lexical_scope); lexical_scope = lexical_scope->parent_scope(); }