From 9b359eb75ba5292b5087992ff0c452e8cbe858a6 Mon Sep 17 00:00:00 2001 From: Michael Schimmel Date: Mon, 8 Sep 2025 19:27:37 +0200 Subject: [PATCH] Fix in AsRecord --- Src/AST/Myc.Ast.Evaluator.pas | 4 ++-- Src/AST/Myc.Ast.Nodes.pas | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Src/AST/Myc.Ast.Evaluator.pas b/Src/AST/Myc.Ast.Evaluator.pas index 15b8a7d..c1749cc 100644 --- a/Src/AST/Myc.Ast.Evaluator.pas +++ b/Src/AST/Myc.Ast.Evaluator.pas @@ -290,7 +290,7 @@ begin with seriesVar.AsRecordSeries.Value do begin - Add(itemValue.AsRecord, lookback); + Add(itemValue.AsRecord.Value, lookback); end; end; else @@ -415,7 +415,7 @@ begin end; end; avkRecordSeries: Result := TAstValue.FromMemberSeries(baseValue.AsRecordSeries.Value.CreateMemberSeries(memberName)); - avkRecord: Result := baseValue.AsRecord.Items[memberName]; + avkRecord: Result := baseValue.AsRecord.Value.Items[memberName]; else raise EArgumentException.Create('Member access operator `.` is not supported for this value type.'); end; diff --git a/Src/AST/Myc.Ast.Nodes.pas b/Src/AST/Myc.Ast.Nodes.pas index da2becc..e34c5df 100644 --- a/Src/AST/Myc.Ast.Nodes.pas +++ b/Src/AST/Myc.Ast.Nodes.pas @@ -90,7 +90,7 @@ type function AsClosure: TAstValue.IClosure; inline; function AsText: String; inline; function AsRecordSeries: TVal; inline; - function AsRecord: TScalarRecord; inline; + function AsRecord: TVal; inline; function AsMemberSeries: TVal; inline; function AsSeries: TVal; inline; function ToString: String; @@ -360,11 +360,11 @@ begin Result := TVal(FInterface); end; -function TAstValue.AsRecord: TScalarRecord; +function TAstValue.AsRecord: TVal; begin if (FKind <> avkRecord) then raise EInvalidCast.Create('Cannot read value as Record.'); - Result := (FInterface as TVal).Value; + Result := (FInterface as TVal); end; function TAstValue.AsRecordSeries: TVal;