Ignore:
Timestamp:
Jun 26, 2023, 12:08:45 PM (17 months ago)
Author:
chronos
Message:
  • Added: Var function parameters support.
  • Added: Read and ReadLn procedures support.
  • Added: Interpreter now prints into console form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/xpascal/Optimizer.pas

    r224 r230  
    1414  TOptimizer = class
    1515  private
    16     procedure OptimizeNodes(SourceNodes: TSourceNodes; out NewNode: TSourceNode);
     16    procedure OptimizeNodes(SourceNodes: TSourceNodeList<TSourceNode>; out NewNode: TSourceNode);
    1717    procedure OptimizeNode(SourceNode: TSourceNode; out NewNode: TSourceNode);
    1818  public
     
    2424implementation
    2525
     26resourcestring
     27  SUnsupportedNodeType = 'Unsupported node type';
     28
    2629{ TOptimizer }
    2730
    28 procedure TOptimizer.OptimizeNodes(SourceNodes: TSourceNodes; out
     31procedure TOptimizer.OptimizeNodes(SourceNodes: TSourceNodeList<TSourceNode>; out
    2932  NewNode: TSourceNode);
    3033var
     
    3841        SourceNodes[I] := TempNewNode;
    3942      end;
    40     end else raise Exception.Create('Unsupported node type');
     43    end else raise Exception.Create(SUnsupportedNodeType);
    4144  end;
    4245end;
     
    5659  if SourceNode = nil then begin
    5760  end else
    58   if SourceNode is TSourceNodes then begin
    59     OptimizeNodes(TSourceNodes(SourceNode), NewNode)
     61  if SourceNode is TSourceNodeList<TSourceNode> then begin
     62    OptimizeNodes(TSourceNodeList<TSourceNode>(SourceNode), NewNode)
    6063  end else
    6164  if (ofReplaceRepeatUntilByWhileDo in Features) and (SourceNode is TRepeatUntil) then begin
     
    109112    end;
    110113  end else
    111     raise Exception.Create('Unsupported node type');
     114    raise Exception.Create(SUnsupportedNodeType);
    112115end;
    113116
Note: See TracChangeset for help on using the changeset viewer.