RTL refactoring
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user