Ignore:
Timestamp:
Nov 5, 2010, 9:36:20 AM (14 years ago)
Author:
george
Message:
  • Fixed: Variable and constant expression.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Produce/UProducerDynamicC.pas

    r2 r5  
    274274function TProducerDynamicC.GenerateExpression(Expression: TExpression): string;
    275275begin
    276   case Expression.NodeType of
    277     ntConstant: begin
    278       if VarType(Expression.Value) = varString then
    279         Result := '"' + Expression.Value + '"'
    280         else Result := Expression.Value;
    281     end;
    282     ntVariable: Result := Expression.Variable.Name;
    283     ntFunction: Result := Expression.FunctionCall.Name;
    284     ntOperator: begin
    285       Result := GenerateExpression(TExpression(Expression.SubItems.First))
    286         + ' ' + TranslateOperator(Expression.OperatorName) + ' ' +
    287         GenerateExpression(TExpression(Expression.SubItems.Last));
    288     end;
    289     ntNone: ;
     276  if Assigned(Expression) then begin
     277    case Expression.NodeType of
     278      ntConstant: begin
     279        Result := Expression.Constant.Name;
     280      end;
     281      ntValue: begin
     282       if VarType(Expression.Value) = varString then
     283          Result := '"' + Expression.Value + '"'
     284          else Result := Expression.Value;
     285      end;
     286      ntVariable: Result := Expression.Variable.Name;
     287      ntFunction: Result := Expression.FunctionCall.Name;
     288      ntOperator: begin
     289        Result := GenerateExpression(TExpression(Expression.SubItems.First))
     290          + ' ' + TranslateOperator(Expression.OperatorName) + ' ' +
     291          GenerateExpression(TExpression(Expression.SubItems.Last));
     292      end;
     293      ntNone: ;
     294    end;
     295    if Expression.Braces then Result := '(' + Result + ')';
    290296  end;
    291297end;
Note: See TracChangeset for help on using the changeset viewer.