Exemplo n.º 1
0
        public void Visit(PrintStatementNode print)
        {
            var reversedItems = ((IEnumerable <IPrintItemNode>)print.Items).Reverse();

            foreach (var item in reversedItems)
            {
                item.Accept(this);
            }
            var parameters = string.Join(" + ", Enumerable.Repeat("stack.pop()", print.Items.Count));

            Emit("console.log(\"\" + {0});", parameters);
        }
Exemplo n.º 2
0
 public void Visit(PrintStatementNode print)
 {
     foreach (var item in print.Items)
     {
         item.Accept(this);
         EmitComment("Print one item");
         if (item is StringNode)
         {
             Emit("call", "void [mscorlib]System.Console::Write(string)");
         }
         else
         {
             Emit("call", "void [mscorlib]System.Console::Write(int32)");
         }
     }
     EmitComment("Done printing");
     Emit("call", "void [mscorlib]System.Console::WriteLine()");
 }
 public void Visit(PrintStatementNode print)
 {
     foreach (var item in print.Items)
     {
         EmitComment("Print one item");
         Emit("getstatic", "java/lang/System/out", "Ljava/io/PrintStream;");
         item.Accept(this);
         if (item is StringNode)
         {
             Emit("invokevirtual", "java/io/PrintStream/print(Ljava/lang/String;)V");
         }
         else
         {
             Emit("invokevirtual", "java/io/PrintStream/print(I)V");
         }
     }
     EmitComment("Done printing");
     Emit("getstatic", "java/lang/System/out", "Ljava/io/PrintStream;");
     Emit("invokevirtual", "java/io/PrintStream/println()V");
 }
 public void Visit(PrintStatementNode print)
 {
     foreach (var item in print.Items)
     {
         EmitComment("Print one item");
         Emit("getstatic", "java/lang/System/out", "Ljava/io/PrintStream;");
         item.Accept(this);
         if (item is StringNode)
             Emit("invokevirtual", "java/io/PrintStream/print(Ljava/lang/String;)V");
         else
             Emit("invokevirtual", "java/io/PrintStream/print(I)V");
     }
     EmitComment("Done printing");
     Emit("getstatic", "java/lang/System/out", "Ljava/io/PrintStream;");
     Emit("invokevirtual", "java/io/PrintStream/println()V");
 }
Exemplo n.º 5
0
 public void Visit(PrintStatementNode print)
 {
     foreach (var item in print.Items)
     {
         item.Accept(this);
         EmitComment("Print one item");
         if (item is StringNode)
             Emit("call", "void [mscorlib]System.Console::Write(string)");
         else
             Emit("call", "void [mscorlib]System.Console::Write(int32)");
     }
     EmitComment("Done printing");
     Emit("call", "void [mscorlib]System.Console::WriteLine()");
 }
 public void Visit(PrintStatementNode print)
 {
     var reversedItems = ((IEnumerable<IPrintItemNode>) print.Items).Reverse();
     foreach (var item in reversedItems)
     {
         item.Accept(this);
     }
     var parameters = string.Join(" + ", Enumerable.Repeat("stack.pop()", print.Items.Count));
     Emit("console.log(\"\" + {0});", parameters);
 }