Ast Binding

This commit is contained in:
Michael Schimmel
2025-09-04 01:41:09 +02:00
parent de052cab64
commit 9c90a92b04
6 changed files with 394 additions and 382 deletions
+14 -3
View File
@@ -101,9 +101,20 @@ type
function GetParent: IExecutionScope;
{$endregion}
procedure Clear;
function FindValue(const Name: string; out Value: TAstValue): Boolean;
procedure SetValue(const Name: string; const Value: TAstValue);
procedure AssignValue(const Name: string; const Value: TAstValue);
// --- Legacy name-based access (for pre-binder setup, e.g., native functions) ---
function FindValue(const Name: string; out Value: TAstValue): Boolean; deprecated 'Use index-based access after binding.';
procedure SetValue(const Name: string; const Value: TAstValue); deprecated 'Use Define for script variables.';
procedure AssignValue(const Name: string; const Value: TAstValue); overload; deprecated 'Use index-based assignment after binding.';
// --- New index-based access (for use by the evaluator after binding) ---
// Defines a new variable in the current scope.
procedure Define(const Name: string; const Value: TAstValue);
// Gets a value from a scope at a specific depth and slot index.
function GetValue(Depth, Index: Integer): TAstValue;
// Assigns a new value to an existing variable at a specific depth and slot index.
procedure AssignValue(Depth, Index: Integer; const Value: TAstValue); overload;
function Dump: string;
property Parent: IExecutionScope read GetParent;
end;