diff options
Diffstat (limited to 'src/backend/backend.c')
-rw-r--r-- | src/backend/backend.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/backend.c b/src/backend/backend.c index ff9d0bf..b6b78bd 100644 --- a/src/backend/backend.c +++ b/src/backend/backend.c @@ -99,11 +99,12 @@ void anotate_machine(struct AST_Machine *machine,struct AST_Translation_Unit *un for(i=0;i<machine->transitions->size;++i) { machine->transitions->transitions[i]->statement=anotate_statement(machine->transitions->transitions[i]->statement,unit,machine,translation_data); + if(machine->transitions->transitions[i]->granted) + machine->transitions->transitions[i]->granted=anotate_expression(machine->transitions->transitions[i]->granted,unit,machine,translation_data); } if(has_new_errors(translation_data)) { push_error_with_token("in machine",machine->id,translation_data); - delete_ast_machine(machine); } } struct AST* anotate_statement(struct AST *statement,struct AST_Translation_Unit *unit,struct AST_Machine *current_machine,struct Translation_Data *translation_data) @@ -134,7 +135,10 @@ struct AST* anotate_expression(struct AST *expression,struct AST_Translation_Uni if(hold_machine==NULL) { push_error_with_token("machine id is undefined",((struct AST_Unchecked_State*)hold_left)->name,translation_data); - delete_ast(expression); + return NULL; + }else if(hold_machine==current_machine) + { + push_error_with_token("using a state from the current machine is disallowed",((struct AST_Unchecked_State*)hold_left)->name,translation_data); return NULL; }else { @@ -142,12 +146,10 @@ struct AST* anotate_expression(struct AST *expression,struct AST_Translation_Uni if(hold_left) { ((struct AST_State*)hold_left)->parent=hold_machine; - delete_ast(hold_right); return hold_left; }else { push_error_with_token("state id from foreign machine is undefined",((struct AST_Unchecked_State*)hold_right)->name,translation_data); - delete_ast(hold_right); return NULL; } } |