Add update Methods for Compilation Context

update method will allow the creation of a new compilation context
based on the current one with new types/names.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-03-13 07:03:31 -04:00
parent 636db140ce
commit 377f40447f
4 changed files with 34 additions and 4 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ public struct Program {
{
case Result.Ok((let parser, let updated_context)):
// Create a new context with the name of the parser that was just compiled in scope.
compilation_context = CompilerContext(withNames: updated_context.names.declare(identifier: parser.name, withValue: parser))
compilation_context = compilation_context.update(newNames: updated_context.names.declare(identifier: parser.name, withValue: parser))
case Result.Error(let error): errors.append(error)
}