Ignore:
Timestamp:
Apr 22, 2020, 12:02:17 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Implemented generic access to fields in source tree.
  • Added: Generator to XML.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/interpreter2/UOptimizer.pas

    r207 r208  
    4646  WhileDo: TWhileDo;
    4747  Condition: TIfThenElse;
     48  Field: TField;
     49  Obj: TObject;
    4850begin
    4951  NewNode := nil;
     
    7375  end else
    7476  if SourceNode is TSourceNode then begin
    75     for I := 0 to SourceNode.NodesCount - 1 do begin
    76       OptimizeNode(TSourceNode(SourceNode.Nodes[I]), NewNode);
    77       if Assigned(NewNode) and (NewNode <> TSourceNode(SourceNode.Nodes[I])) then begin
    78         SourceNode.Nodes[I] := NewNode;
     77    for I := 0 to SourceNode.FieldsCount - 1 do begin
     78      Field := SourceNode.GetField(I);
     79      if Field.DataType = dtObject then begin
     80        SourceNode.GetValue(I, Obj);
     81        if Obj is TSourceNode then begin
     82          OptimizeNode(TSourceNode(Obj), NewNode);
     83          if Assigned(NewNode) and (NewNode <> TSourceNode(Obj)) then begin
     84            SourceNode.SetValueObject(I, NewNode);
     85          end;
     86        end;
    7987      end;
     88      Field.Free;
    8089    end;
    8190  end else
Note: See TracChangeset for help on using the changeset viewer.