示例#1
0
 public override void ToString(NodeWriter writer)
 {
     writer.OpenNode($"i64.const");
     writer.EnsureSpace();
     writer.Write(Value);
     writer.CloseNode();
 }
示例#2
0
        public override void ToString(NodeWriter writer)
        {
            writer.EnsureNewLine();
            writer.OpenNode("global");
            writer.EnsureSpace();
            writer.Write($"${Name}");
            writer.EnsureSpace();

            writer.Write("(");
            if (Mutable)
            {
                writer.Write("mut ");
            }
            writer.WriteValue(Type);
            writer.Write(")");

            if (Init != null && !Init.Empty)
            {
                writer.EnsureNewLine();
                Init.ToString(writer);
                writer.EnsureNewLine();
            }

            writer.CloseNode();
        }
示例#3
0
 public override void ToString(NodeWriter writer)
 {
     writer.OpenNode("func");
     writer.WriteFunctionName(this);
     for (var i = 0; i < Parameters.Count; i++)
     {
         var param = Parameters[i];
         writer.OpenNode("param");
         if (Execution != null)
         {
             writer.EnsureSpace();
             writer.Write($"${param.Name}");
         }
         writer.WriteValue(param.Type);
         writer.CloseNode();
     }
     if (Signature.Return != WasmType.BlockType)
     {
         writer.OpenNode("result");
         writer.WriteValue(Signature.Return);
         writer.CloseNode();
     }
     if (Execution != null)
     {
         writer.EnsureNewLine();
         foreach (var local in Variables)
         {
             local.ToString(writer);
         }
         Execution.ToString(writer);
         writer.EnsureNewLine();
     }
     writer.CloseNode();
 }
示例#4
0
 public override void ToString(NodeWriter writer)
 {
     writer.OpenNode($"get_local");
     writer.EnsureSpace();
     writer.Write($"${Variable.Name}");
     writer.CloseNode();
 }
示例#5
0
        public sealed override string ToString()
        {
            var writer = new NodeWriter();

            ToString(writer);
            return(writer.ToString().Trim());
        }
示例#6
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("nop");
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#7
0
        public override void ToString(NodeWriter writer)
        {
            writer.EnsureNewLine();
            writer.OpenNode("call_indirect");

            if (Arguments.Count > 0)
            {
                writer.EnsureNewLine();
            }
            else
            {
                writer.EnsureSpace();
            }

            Element.ToString(writer);

            foreach (var arg in Arguments)
            {
                writer.EnsureNewLine();
                arg.ToString(writer);
            }

            if (Arguments.Count > 0)
            {
                writer.EnsureNewLine();
            }
            writer.CloseNode();
        }
示例#8
0
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine($"({NodeName}");
     writer.Indent();
     Expression.ToString(writer);
     writer.Unindent();
     writer.WriteLine(")");
 }
示例#9
0
 public void ToString(NodeWriter writer)
 {
     foreach (var node in _nodes)
     {
         writer.EnsureNewLine();
         node.ToString(writer);
     }
 }
示例#10
0
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine($"(grow_memory");
     writer.Indent();
     Expression.ToString(writer);
     writer.Unindent();
     writer.WriteLine(")");
 }
示例#11
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("br");
     writer.WriteLabelName(Target);
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#12
0
 public sealed override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode(NodeName);
     writer.EnsureSpace();
     Expression.ToString(writer);
     writer.CloseNode();
 }
示例#13
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("set_local");
     writer.WriteVariableName(Variable);
     writer.EnsureSpace();
     Value.ToString(writer);
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#14
0
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine("(select");
     writer.Indent();
     Condition.ToString(writer);
     First.ToString(writer);
     Second.ToString(writer);
     writer.Unindent();
     writer.WriteLine(")");
 }
示例#15
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("local");
     writer.EnsureSpace();
     writer.WriteVariableName(this);
     writer.WriteValue(Type);
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#16
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("set_global");
     writer.EnsureSpace();
     writer.Write($"${Variable.Name}");
     writer.EnsureSpace();
     Value.ToString(writer);
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#17
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("block");
     writer.WriteValueOrVoid(ResultType);
     writer.WriteLabelName(Nodes.Label);
     writer.EnsureNewLine();
     Nodes.ToString(writer);
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#18
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("return");
     if (Expression != null)
     {
         writer.EnsureSpace();
         Expression.ToString(writer);
     }
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#19
0
        public sealed override void ToString(NodeWriter writer)
        {
            writer.EnsureNewLine();
            writer.OpenNode(NodeName);
            writer.Write(FormatImmediate());

            writer.EnsureNewLine();
            Address.ToString(writer);

            writer.EnsureNewLine();
            writer.CloseNode();
            writer.EnsureNewLine();
        }
示例#20
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("br_table");
     foreach (var target in Targets)
     {
         writer.EnsureNewLine();
         writer.WriteLabelName(target);
     }
     writer.EnsureNewLine();
     writer.WriteLabelName(DefaultTarget);
     writer.CloseNode();
     //todo: syntax?
 }
示例#21
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("call");
     writer.WriteFunctionName(Function);
     foreach (var arg in Arguments)
     {
         writer.EnsureNewLine();
         arg.ToString(writer);
     }
     if (Arguments.Count > 0)
     {
         writer.EnsureNewLine();
     }
     writer.CloseNode();
     writer.EnsureNewLine();
 }
示例#22
0
        public override void ToString(NodeWriter writer)
        {
            writer.OpenNode("module");

            foreach (var import in Imports)
            {
                import.ToString(writer);
            }

            foreach (var global in Globals)
            {
                global.ToString(writer);
            }

            foreach (var func in Functions)
            {
                writer.EnsureNewLine();
                func.ToString(writer);
            }

            writer.EnsureNewLine();
            writer.CloseNode();
        }
示例#23
0
        public override void ToString(NodeWriter writer)
        {
            writer.EnsureNewLine();
            writer.OpenNode("if");

            writer.WriteLabelName(_then.Label);
            writer.WriteValueOrVoid(Signature);

            writer.EnsureNewLine();
            Condition.ToString(writer);

            writer.EnsureNewLine();
            Then.ToString(writer);
            writer.EnsureNewLine();

            if (Else != null)
            {
                new ElseNode(_else).ToString(writer);
                writer.EnsureNewLine();
            }

            writer.CloseNode();
            writer.EnsureNewLine();
        }
示例#24
0
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine($"(current_memory)");
 }
示例#25
0
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine("(unreachable)");
 }
示例#26
0
 public abstract void ToString(NodeWriter writer);
示例#27
0
 public override void ToString(NodeWriter writer) => throw new System.NotImplementedException();