Ignore:
Timestamp:
Aug 5, 2010, 9:51:16 AM (14 years ago)
Author:
george
Message:

Fixed expression parsing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/UPascalSource.pas

    r38 r39  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms,
    9   Dialogs, StdCtrls, Contnrs;
     9  Dialogs, Contnrs;
    1010
    1111type
     
    200200  end;
    201201
     202  { TExpression }
     203
    202204  TExpression = class
    203205    CommonBlock: TCommonBlock;
     
    211213    constructor Create;
    212214    destructor Destroy; override;
     215    procedure Assign(Source: TExpression);
    213216  end;
    214217
     
    310313
    311314destructor TConstantList.Destroy;
    312 var
    313   I: Integer;
    314 begin
    315   for I := 0 to Count - 1 do
    316     TConstant(Items[I]).Free;
     315begin
    317316  inherited;
    318317end;
     
    394393
    395394destructor TTypeList.Destroy;
    396 var
    397   I: Integer;
    398 begin
    399   for I := 0 to Count - 1 do
    400     TType(Items[I]).Free;
     395begin
    401396  inherited;
    402397end;
     
    430425  while (I < Count) and (TVariable(Items[I]).Name <> Name) do Inc(I);
    431426  if I < Count then Result := TVariable(Items[I]) else begin
    432     if Assigned(Parent.Parent) then Result := Parent.Parent.Variables.Search(Name)
    433       else begin
    434         Result := nil;
    435       end;
     427    if Assigned(Parent.Parent) then
     428      Result := Parent.Parent.Variables.Search(Name)
     429      else Result := nil;
    436430  end;
    437431end;
     
    473467  SubItems := TExpressionList.Create;
    474468  SubItems.Count := 2;
     469  SubItems.OwnsObjects := False;
    475470end;
    476471
     
    479474  SubItems.Free;
    480475  inherited;
     476end;
     477
     478procedure TExpression.Assign(Source: TExpression);
     479begin
     480  CommonBlock := Source.CommonBlock;
     481  NodeType := Source.NodeType;
     482  Method := Source.Method;
     483  Value := Source.Value;
     484  Associated := Source.Associated;
     485  OperatorName := Source.OperatorName;
     486  Variable := Source.Variable;
     487  SubItems.Assign(Source.SubItems);
    481488end;
    482489
     
    503510
    504511destructor TExpressionList.Destroy;
    505 var
    506   I: Integer;
    507 begin
    508   for I := 0 to Count - 1 do
    509     TExpression(Items[I]).Free;
     512begin
    510513  inherited;
    511514end;
     
    514517
    515518destructor TParameterList.Destroy;
    516 var
    517   I: Integer;
    518 begin
    519   for I := 0 to Count - 1 do
    520     TParameter(Items[I]).Free;
     519begin
    521520  inherited;
    522521end;
Note: See TracChangeset for help on using the changeset viewer.