Fix in Recur Node declaration
This commit is contained in:
@@ -269,7 +269,8 @@ function TAstDumper.VisitRecurNode(const Node: IRecurNode): TDataValue;
|
||||
var
|
||||
arg: IAstNode;
|
||||
begin
|
||||
LogFmt('Recur (IsTailCall: %s)', [Node.IsTailCall.ToString(TUseBoolStrs.True)]);
|
||||
// 'recur' must be a tail call, which is enforced by the binder.
|
||||
Log('Recur');
|
||||
Indent;
|
||||
LogFmt('Arguments (%d):', [Length(Node.Arguments)]);
|
||||
Indent;
|
||||
|
||||
@@ -269,9 +269,6 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
// The binder ensures this is only in a tail position.
|
||||
if not Node.IsTailCall then
|
||||
raise EInvalidOperation.Create('Recur has to be a tail call');
|
||||
|
||||
SetLength(argValues, Length(Node.Arguments));
|
||||
for i := 0 to High(Node.Arguments) do
|
||||
argValues[i] := Node.Arguments[i].Accept(Self);
|
||||
|
||||
@@ -156,10 +156,8 @@ type
|
||||
IRecurNode = interface(IAstNode)
|
||||
{$region 'private'}
|
||||
function GetArguments: TArray<IAstNode>;
|
||||
function GetIsTailCall: Boolean;
|
||||
{$endregion}
|
||||
property Arguments: TArray<IAstNode> read GetArguments;
|
||||
property IsTailCall: Boolean read GetIsTailCall;
|
||||
end;
|
||||
|
||||
IBlockExpressionNode = interface(IAstNode)
|
||||
|
||||
@@ -157,7 +157,6 @@ type
|
||||
private
|
||||
FArguments: TArray<IAstNode>;
|
||||
function GetArguments: TArray<IAstNode>;
|
||||
function GetIsTailCall: Boolean;
|
||||
public
|
||||
constructor Create(const AArguments: TArray<IAstNode>);
|
||||
function Accept(const Visitor: IAstVisitor): TDataValue; override;
|
||||
@@ -472,12 +471,6 @@ begin
|
||||
Result := FArguments;
|
||||
end;
|
||||
|
||||
function TRecurNode.GetIsTailCall: Boolean;
|
||||
begin
|
||||
// 'recur' is always a tail call by definition.
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{ TBlockExpressionNode }
|
||||
|
||||
constructor TBlockExpressionNode.Create(const AExpressions: array of IAstNode);
|
||||
|
||||
Reference in New Issue
Block a user