Generic Visitors

This commit is contained in:
Michael Schimmel
2026-01-02 14:18:46 +01:00
parent 13d8a21de7
commit 2e0db2682f
3 changed files with 49 additions and 61 deletions
-14
View File
@@ -23,9 +23,6 @@ type
FScope: IExecutionScope;
protected
// Setup the registry-based handlers
procedure SetupHandlers; override;
// --- Core Logic Implementation (Legacy Virtual Overrides) ---
// These are kept as virtual methods so TDebugEvaluatorVisitor can still override them.
function VisitConstant(const Node: IConstantNode): TDataValue; override;
@@ -117,17 +114,6 @@ begin
Assert(Assigned(AScope));
end;
procedure TEvaluatorVisitor.SetupHandlers;
begin
// The base SetupHandlers registers delegates that call the virtual methods (VisitConstant, etc.).
// Since TEvaluatorVisitor still implements its logic by overriding these virtual methods (for now),
// we just call inherited.
//
// In Phase 2/3 of refactoring, we would move the logic from VisitConstant directly into
// anonymous methods or separate handler functions registered here, bypassing the virtual table.
inherited;
end;
function TEvaluatorVisitor.Execute(const RootNode: IAstNode): TDataValue;
begin
if not Assigned(RootNode) then