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:
Will Hawkins
2026-05-29 17:33:19 -04:00
parent 297288e2b0
commit 4f6de341cc
3 changed files with 146 additions and 77 deletions
+4 -3
View File
@@ -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)
}
}