RTL refactoring

This commit is contained in:
Michael Schimmel
2026-01-13 17:01:33 +01:00
parent 1429278765
commit 1c6a6fe5a0
9 changed files with 1031 additions and 1012 deletions
+44
View File
@@ -72,6 +72,26 @@ type
property Signature: string read FSignature;
end;
// Decorates a native function to be exported to the Myc runtime.
// 'IsPure' hints the compiler that the function has no side effects.
TRtlExportAttribute = class(TCustomAttribute)
type
TPurity = (Pure, Impure);
public
Name: string;
IsPure: Boolean;
constructor Create(const AName: string); overload;
constructor Create(const AName: string; APurity: TPurity); overload;
end;
// Decorates a class function to be exported as a constant value.
// The function is invoked once at registration time.
TRtlConstAttribute = class(TCustomAttribute)
public
Name: string;
constructor Create(const AName: string);
end;
implementation
{ AstTagAttribute }
@@ -116,4 +136,28 @@ begin
FSignature := ASignature;
end;
//==================================================================================================
// Attribute Implementations
//==================================================================================================
constructor TRtlExportAttribute.Create(const AName: string);
begin
inherited Create;
Name := AName;
IsPure := False;
end;
constructor TRtlExportAttribute.Create(const AName: string; APurity: TPurity);
begin
inherited Create;
Name := AName;
IsPure := APurity = Pure;
end;
constructor TRtlConstAttribute.Create(const AName: string);
begin
inherited Create;
Name := AName;
end;
end.