Ignore:
Timestamp:
Apr 22, 2020, 10:23:31 PM (5 years ago)
Author:
chronos
Message:
  • Added: Transformation of Result variable assignment into Return statement.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/interpreter2/UGeneratorPhp.pas

    r212 r213  
    3131    procedure GenerateExpressionOperand(Block: TBlock; Expression: TExpressionOperand);
    3232    procedure GenerateBreak(Block: TBlock; BreakCmd: TBreak);
     33    procedure GenerateReturn(Block: TBlock; Return: TReturn);
    3334    procedure GenerateContinue(Block: TBlock; ContinueCmd: TContinue);
    3435    procedure GenerateValue(Value: TValue);
     
    5354  else if Command is TBreak then GenerateBreak(Block, TBreak(Command))
    5455  else if Command is TContinue then GenerateContinue(Block, TContinue(Command))
     56  else if Command is TReturn then GenerateReturn(Block, TReturn(Command))
    5557  else if Command is TEmptyCommand then
    5658  else raise Exception.Create('Unsupported command type');
     
    177179begin
    178180  AddText('break');
     181end;
     182
     183procedure TGeneratorPhp.GenerateReturn(Block: TBlock; Return: TReturn);
     184begin
     185  AddText('return ');
     186  GenerateExpression(Block, Return.Expression);
    179187end;
    180188
Note: See TracChangeset for help on using the changeset viewer.