Ignore:
Timestamp:
Jun 29, 2023, 1:47:58 AM (17 months ago)
Author:
chronos
Message:
  • Fixed: Var function parameters processed correctly for both user defined and internal functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/xpascal/Source.pas

    r233 r236  
    133133    Block: TBlock;
    134134    ParentType: TType;
     135    procedure InitVariables;
    135136    procedure GetValue(Index: Integer; out Value); override;
    136137    function GetField(Index: Integer): TField; override;
     
    159160    Block: TBlock;
    160161    ParentType: TType;
     162    procedure InitVariables;
    161163    procedure GetValue(Index: Integer; out Value); override;
    162164    function GetField(Index: Integer): TField; override;
     
    533535end;
    534536
     537procedure TProcedure.InitVariables;
     538var
     539  I: Integer;
     540  Variable: TVariable;
     541begin
     542  for I := 0 to Params.Count - 1 do begin
     543    Variable := TVariable.Create;
     544    Variable.Name := Params[I].Name;
     545    Variable.TypeRef := Params[I].TypeRef;
     546    Variable.Internal := True;
     547    Block.Variables.Add(Variable);
     548  end;
     549end;
     550
    535551procedure TProcedure.GetValue(Index: Integer; out Value);
    536552begin
     
    932948begin
    933949  Result := 4;
     950end;
     951
     952procedure TFunction.InitVariables;
     953var
     954  I: Integer;
     955  Variable: TVariable;
     956begin
     957  for I := 0 to Params.Count - 1 do begin
     958    Variable := TVariable.Create;
     959    Variable.Name := Params[I].Name;
     960    Variable.TypeRef := Params[I].TypeRef;
     961    Variable.Internal := True;
     962    Block.Variables.Add(Variable);
     963  end;
     964
     965  Variable := TVariable.Create;
     966  Variable.Name := 'Result';
     967  Variable.TypeRef := ResultType;
     968  Variable.Internal := True;
     969  Block.Variables.Add(Variable);
    934970end;
    935971
Note: See TracChangeset for help on using the changeset viewer.