Exemplo n.º 1
0
 private void GenerateVarOrCallChain(VarOrCallChain varOrCallChain)
 {
     foreach (var varOrCall in varOrCallChain.varOrCalls)
     {
         if (varOrCall.symbolToAccessOrCall.GetType() == typeof(Function))
         {
             var funToCall = (Function)varOrCall.symbolToAccessOrCall;
             writer.Write($"{funToCall.type.name}::{funToCall.name}(");
             var isFirstArg = true;
             foreach (var argExpr in varOrCall.argumentExpressions)
             {
                 if (!isFirstArg)
                 {
                     writer.Write(", ");
                 }
                 isFirstArg = false;
                 GenerateExpression(argExpr);
             }
             writer.Write($")");
         }
         else if (varOrCall.symbolToAccessOrCall.GetType() == typeof(DeclarationStatement))
         {
             var declarationStatement = (DeclarationStatement)varOrCall.symbolToAccessOrCall;
             writer.Write($"{declarationStatement.name}");
         }
         else if (varOrCall.symbolToAccessOrCall.GetType() == typeof(FunctionArg))
         {
             var functionArg = (FunctionArg)varOrCall.symbolToAccessOrCall;
             writer.Write($"{functionArg.name}");
         }
         else
         {
             throw new ArgumentException($"Unknown symbol type: {varOrCall.symbolToAccessOrCall.GetType().Name}");
         }
     }
 }
Exemplo n.º 2
0
Arquivo: Module.cs Projeto: Xed89/luna
 public VarOrCallChainMaybeAssignStatement(VarOrCallChain varOrCallChain, IExpression valueToAssignExpression)
 {
     this.varOrCallChain          = varOrCallChain;
     this.valueToAssignExpression = valueToAssignExpression;
 }