Ignore:
Timestamp:
Aug 9, 2010, 12:48:14 PM (14 years ago)
Author:
george
Message:

Support for function definition with result type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/Produce/UProducerC.pas

    r46 r47  
    2929    procedure GenerateIfThenElse(IfThenElse: TIfThenElse);
    3030    procedure GenerateAssignment(Assignment: TAssignment);
    31     procedure GenerateMethodCall(MethodCall: TMethodCall);
     31    procedure GenerateMethodCall(MethodCall: TFunctionCall);
    3232    function GenerateExpression(Expression: TExpression): string;
    3333  public
     
    158158  else if Command is TIfThenElse then GenerateIfThenElse(TIfThenElse(Command))
    159159  else if Command is TAssignment then GenerateAssignment(TAssignment(Command))
    160   else if Command is TMethodCall then GenerateMethodCall(TMethodCall(Command));
     160  else if Command is TFunctionCall then GenerateMethodCall(TFunctionCall(Command));
    161161end;
    162162
     
    171171  Emit('if(' + GenerateExpression(IfThenElse.Condition) + ')');
    172172  GenerateCommand(IfThenElse.Command);
    173   Emit('else ');
    174   GenerateCommand(IfThenElse.ElseCommand);
     173  if Assigned(IfThenElse.ElseCommand) then begin
     174    Emit('else ');
     175    GenerateCommand(IfThenElse.ElseCommand);
     176  end;
    175177end;
    176178
     
    180182end;
    181183
    182 procedure TCProducer.GenerateMethodCall(MethodCall: TMethodCall);
    183 begin
    184   Emit(MethodCall.Method.Name + '();');
     184procedure TCProducer.GenerateMethodCall(MethodCall: TFunctionCall);
     185begin
     186  Emit(MethodCall.FunctionRef.Name + '();');
    185187end;
    186188
Note: See TracChangeset for help on using the changeset viewer.