Moved operator helpers
This commit is contained in:
@@ -6,6 +6,7 @@ uses
|
||||
System.SysUtils,
|
||||
System.Classes,
|
||||
System.Generics.Collections,
|
||||
Myc.Data.Scalar,
|
||||
Myc.Data.Value,
|
||||
Myc.Ast.Nodes,
|
||||
Myc.Ast.Scope,
|
||||
|
||||
@@ -9,14 +9,6 @@ uses
|
||||
Myc.Data.Value;
|
||||
|
||||
type
|
||||
TBinaryOperatorHelper = record helper for TBinaryOperator
|
||||
function ToString: string;
|
||||
end;
|
||||
|
||||
TUnaryOperatorHelper = record helper for TUnaryOperator
|
||||
function ToString: string;
|
||||
end;
|
||||
|
||||
// --- Forward Declarations to break cycles ---
|
||||
IAstVisitor = interface;
|
||||
IAstNode = interface;
|
||||
@@ -284,36 +276,4 @@ begin
|
||||
Dest.SlotIndex := -1;
|
||||
end;
|
||||
|
||||
{ TBinaryOperatorHelper }
|
||||
|
||||
function TBinaryOperatorHelper.ToString: string;
|
||||
begin
|
||||
case Self of
|
||||
boAdd: Result := '+';
|
||||
boSubtract: Result := '-';
|
||||
boMultiply: Result := '*';
|
||||
boDivide: Result := '/';
|
||||
boEqual: Result := '==';
|
||||
boNotEqual: Result := '!=';
|
||||
boLess: Result := '<';
|
||||
boGreater: Result := '>';
|
||||
boLessOrEqual: Result := '<=';
|
||||
boGreaterOrEqual: Result := '>=';
|
||||
else
|
||||
Result := '?';
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TUnaryOperatorHelper }
|
||||
|
||||
function TUnaryOperatorHelper.ToString: string;
|
||||
begin
|
||||
case Self of
|
||||
uoNegate: Result := '-';
|
||||
uoNot: Result := 'not';
|
||||
else
|
||||
Result := '?';
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user