From 28558614f0664dcea7ffacb6d29164a6d97da5cc Mon Sep 17 00:00:00 2001 From: Michael Schimmel Date: Fri, 19 Sep 2025 15:10:24 +0200 Subject: [PATCH] RTL enhancements --- ASTPlayground/ASTPlayground.dproj | 2 +- Src/AST/Myc.Ast.RTL.Core.pas | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ASTPlayground/ASTPlayground.dproj b/ASTPlayground/ASTPlayground.dproj index e961501..2eeac5b 100644 --- a/ASTPlayground/ASTPlayground.dproj +++ b/ASTPlayground/ASTPlayground.dproj @@ -4,7 +4,7 @@ 20.3 FMX True - Release + Debug Win64 ASTPlayground 2 diff --git a/Src/AST/Myc.Ast.RTL.Core.pas b/Src/AST/Myc.Ast.RTL.Core.pas index 5cf4019..d5ddd28 100644 --- a/Src/AST/Myc.Ast.RTL.Core.pas +++ b/Src/AST/Myc.Ast.RTL.Core.pas @@ -16,19 +16,19 @@ type TRtlFunctions = record public [TRtlFunction('Abs')] - class function Abs(Arg: TScalar): TScalar; static; + class function Abs(const Arg: TScalar): TScalar; static; [TRtlFunction('Trunc')] - class function Trunc(Arg: TScalar): TScalar; static; + class function Trunc(const Arg: TScalar): TScalar; static; [TRtlFunction('Ceil')] - class function Ceil(Arg: TScalar): TScalar; static; + class function Ceil(const Arg: TScalar): TScalar; static; [TRtlFunction('Floor')] - class function Floor(Arg: TScalar): TScalar; static; + class function Floor(const Arg: TScalar): TScalar; static; [TRtlFunction('Sign')] - class function Sign(Arg: TScalar): TScalar; static; + class function Sign(const Arg: TScalar): TScalar; static; // NOTE: Higher-order and complex functions can keep the TDataValue signature for now. // The registry is smart enough to handle both native types and the TDataValue signature directly. @@ -56,7 +56,7 @@ uses System.Math, Myc.Data.Decimal; -class function TRtlFunctions.Abs(Arg: TScalar): TScalar; +class function TRtlFunctions.Abs(const Arg: TScalar): TScalar; begin case Arg.Kind of skInteger: Result := TScalar.FromInteger(System.Abs(Arg.Value.AsInteger)); @@ -70,7 +70,7 @@ begin end; end; -class function TRtlFunctions.Trunc(Arg: TScalar): TScalar; +class function TRtlFunctions.Trunc(const Arg: TScalar): TScalar; begin case Arg.Kind of skInteger, skInt64: Result := Arg; // Trunc on an integer is a no-op @@ -82,7 +82,7 @@ begin end; end; -class function TRtlFunctions.Ceil(Arg: TScalar): TScalar; +class function TRtlFunctions.Ceil(const Arg: TScalar): TScalar; begin case Arg.Kind of skInteger, skInt64: Result := Arg; // Ceil on an integer is a no-op @@ -94,7 +94,7 @@ begin end; end; -class function TRtlFunctions.Floor(Arg: TScalar): TScalar; +class function TRtlFunctions.Floor(const Arg: TScalar): TScalar; begin case Arg.Kind of skInteger, skInt64: Result := Arg; // Floor on an integer is a no-op @@ -106,7 +106,7 @@ begin end; end; -class function TRtlFunctions.Sign(Arg: TScalar): TScalar; +class function TRtlFunctions.Sign(const Arg: TScalar): TScalar; begin case Arg.Kind of skInteger: Result := TScalar.FromInteger(System.Math.Sign(Arg.Value.AsInteger));