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/Parsers/ParserPascal.pas

    r235 r236  
    372372          if Assigned(TypeRef) then begin
    373373            Func.ResultType := TypeRef;
    374             Variable := TVariable.Create;
    375             Variable.Name := 'Result';
    376             Variable.TypeRef := TypeRef;
    377             Variable.Internal := True;
    378             Func.Block.Variables.Add(Variable);
    379374          end else Error('Type ' + Token.Text + ' not found');
    380375        end;
    381376      end;
    382377      Tokenizer.Expect(';', tkSpecialSymbol);
     378      Func.InitVariables;
    383379      if ParseBlock(Block, NewBlock, Func.Block) then begin
    384380        Tokenizer.Expect(';', tkSpecialSymbol);
     
    405401    end;
    406402    Tokenizer.Expect(')', tkSpecialSymbol);
    407     for I := 0 to Params.Count - 1 do begin
    408       Variable := TVariable.Create;
    409       Variable.Name := Params[I].Name;
    410       Variable.TypeRef := Params[I].TypeRef;
    411       Variable.Internal := True;
    412       Block.Variables.Add(Variable);
    413     end;
    414403    Result := True;
    415404  end;
     
    463452        Proc.Params := FunctionParameters;
    464453      end;
    465 
    466454      Tokenizer.Expect(';', tkSpecialSymbol);
     455      Proc.InitVariables;
    467456      if ParseBlock(Block, NewBlock, Proc.Block) then begin
    468457        Tokenizer.Expect(';', tkSpecialSymbol);
Note: See TracChangeset for help on using the changeset viewer.