compiler: Refactor Transition Statement Compilation
Make it follow the standard protocol(s). Unfortunately that means that some additional information will have to be carried in the compilation context. It seems like a decent tradeoff -- but it may be revisited in the future. Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -178,8 +178,9 @@ extension ParserState: Compilable {
|
||||
sourceLocation: node.toSourceLocation(),
|
||||
withError: "Missing transition statement of state declaration")))
|
||||
|
||||
return SpecialCompilers.TransitionStatement.Compile(
|
||||
node: current_node!, forState: state_identifier, withStatements: parsed_s,
|
||||
withContext: SpecialCompilers.Statements.effect(statements: parsed_s, context: context))
|
||||
let updated_context = SpecialCompilers.Statements.effect(statements: parsed_s, context: context)
|
||||
.update(newLexicalContextName: state_identifier).update(newLexicalContextStatements: parsed_s)
|
||||
|
||||
return TransitionStatement.Compile(node: current_node!, withContext: updated_context)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user