Ignore:
Timestamp:
Aug 9, 2010, 1:53:33 PM (14 years ago)
Author:
george
Message:

Added support of parameters for function call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/UPascalSource.pas

    r47 r48  
    5757  end;
    5858
     59  { TFunctionCall }
     60
    5961  TFunctionCall = class(TCommand)
    6062    FunctionRef: TFunction;
     63    ParameterExpression: TObjectList; // TObjectList<TExpression>
     64    constructor Create;
     65    destructor Destroy; override;
    6166  end;
    6267
     
    136141    Types: TTypeList;
    137142    Variables: TVariableList;
    138     Methods: TFunctionList;
     143    Functions: TFunctionList;
    139144    Code: TBeginEnd;
    140145    constructor Create; virtual;
     
    349354  Variables.Clear;
    350355  Constants.Clear;
    351   Methods.Clear;
     356  Functions.Clear;
    352357  Code.Clear;
    353358end;
     
    386391  Variables := TVariableList.Create;
    387392  Variables.Parent := Self;
    388   Methods := TFunctionList.Create;
    389   Methods.Parent := Self;
     393  Functions := TFunctionList.Create;
     394  Functions.Parent := Self;
    390395  Code := TBeginEnd.Create;
    391396  Code.Parent := Self;
     
    398403  Types.Destroy;
    399404  Variables.Destroy;
    400   Methods.Destroy;
     405  Functions.Destroy;
    401406  Code.Destroy;
    402407  inherited;
     
    416421  I := 0;
    417422  while (I < Count) and (LowerCase(TType(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
    418   if I < Count then Result := TType(Items[I]) else begin
    419     if Assigned(Parent.Parent) then Result := Parent.Parent.Types.Search(Name)
    420       else begin
    421         Result := nil;
    422       end;
    423   end;
     423  if I < Count then Result := TType(Items[I]) else Result := nil;
     424
     425   if not Assigned(Result) and Assigned(Parent.Parent) then
     426     Result := Parent.Parent.Types.Search(Name);
    424427end;
    425428
     
    477480  while (I < Count) and (LowerCase(TFunction(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
    478481  if I < Count then Result := TFunction(Items[I]) else begin
    479     if Assigned(Parent.Parent) then Result := Parent.Parent.Methods.Search(Name)
     482    if Assigned(Parent.Parent) then Result := Parent.Parent.Functions.Search(Name)
    480483      else begin
    481484        Result := nil;
     
    624627end;
    625628
     629{ TFunctionCall }
     630
     631constructor TFunctionCall.Create;
     632begin
     633  inherited;
     634  ParameterExpression := TObjectList.Create;
     635end;
     636
     637destructor TFunctionCall.Destroy;
     638begin
     639  ParameterExpression.Free;
     640  inherited Destroy;
     641end;
     642
    626643end.
    627644
Note: See TracChangeset for help on using the changeset viewer.