AST Types
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -141,6 +141,7 @@ uses
|
||||
Myc.Data.Scalar.JSON,
|
||||
System.Diagnostics, // For TStopwatch
|
||||
Myc.Ast.Json, // For TAstJson serialization
|
||||
Myc.Ast.Types, // Needed for TTypeRules
|
||||
System.IOUtils; // For TFile
|
||||
|
||||
{$R *.fmx}
|
||||
@@ -349,8 +350,8 @@ begin
|
||||
// First, deserialize the AST node from JSON.
|
||||
funcAst := converter.Deserialize(pair.JsonValue as TJSONObject);
|
||||
|
||||
var adr := scopeDescr.FindSymbol(pair.JsonString.Value);
|
||||
if adr.Kind = akUnresolved then
|
||||
var sym := scopeDescr.FindSymbol(pair.JsonString.Value);
|
||||
if sym.Address.Kind = akUnresolved then
|
||||
begin
|
||||
// Distinguish between loading a macro and loading a function.
|
||||
if funcAst is TMacroDefinitionNode then
|
||||
@@ -880,7 +881,7 @@ var
|
||||
binder: IAstBinder;
|
||||
setupAst, boundSetupAst, callAst, boundCallAst: IAstNode;
|
||||
setupDescriptor, callDescriptor: IScopeDescriptor;
|
||||
seriesAddress: TResolvedAddress;
|
||||
seriesAddress: TResolvedSymbol; // Use TResolvedSymbol
|
||||
begin
|
||||
Memo1.Lines.Clear;
|
||||
Memo1.Lines.Add(Format('--- Simulating O(1) SMA Crossover Strategy for %d ticks ---', [numRecs]));
|
||||
@@ -953,7 +954,8 @@ begin
|
||||
|
||||
// 4. Get the address of 'current_series' from the new descriptor.
|
||||
seriesAddress := callDescriptor.FindSymbol('current_series');
|
||||
if seriesAddress.Kind = akUnresolved then
|
||||
// Check seriesAddress.Address.Kind instead of seriesAddress.Kind
|
||||
if seriesAddress.Address.Kind = akUnresolved then
|
||||
raise Exception.Create('Could not resolve current_series address.');
|
||||
|
||||
// 5. Create the final scope and visitor for the simulation loop.
|
||||
@@ -994,7 +996,8 @@ begin
|
||||
|
||||
if series.AsRecordSeries.TotalCount >= smaSlowLength then
|
||||
begin
|
||||
loopScope[seriesAddress] := series;
|
||||
// Use seriesAddress.Address instead of seriesAddress
|
||||
loopScope[seriesAddress.Address] := series;
|
||||
var resultValue := visitor.Execute(boundCallAst);
|
||||
if i mod 50 = 0 then
|
||||
begin
|
||||
|
||||
@@ -17,6 +17,7 @@ uses
|
||||
Myc.Data.Value,
|
||||
Myc.Ast.Nodes,
|
||||
Myc.Ast.Scope,
|
||||
Myc.Ast.Types,
|
||||
Myc.Ast.Visitor,
|
||||
Myc.Fmx.AstEditor.Node,
|
||||
Myc.Fmx.AstEditor.Workspace;
|
||||
@@ -1232,7 +1233,7 @@ begin
|
||||
// This allows the child visitor to correctly visualize parameter nodes.
|
||||
paramDescriptor := TScope.CreateDescriptor(nil);
|
||||
for i := 0 to High(Node.Parameters) do
|
||||
paramDescriptor.Define(Node.Parameters[i].Name);
|
||||
paramDescriptor.Define(Node.Parameters[i].Name, TTypes.Unknown);
|
||||
|
||||
// 3. Create a child visitor for the new scope within the macro's body.
|
||||
const pinNodeHeight = cPinSize + cVerticalPadding;
|
||||
|
||||
Reference in New Issue
Block a user