Exemple #1
0
 public override void ToString(NodeWriter writer)
 {
     writer.OpenNode($"i64.const");
     writer.EnsureSpace();
     writer.Write(Value);
     writer.CloseNode();
 }
Exemple #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();
        }
Exemple #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();
 }
 public override void ToString(NodeWriter writer)
 {
     writer.OpenNode($"get_local");
     writer.EnsureSpace();
     writer.Write($"${Variable.Name}");
     writer.CloseNode();
 }
Exemple #5
0
        public sealed override string ToString()
        {
            var writer = new NodeWriter();

            ToString(writer);
            return(writer.ToString().Trim());
        }
Exemple #6
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("nop");
     writer.CloseNode();
     writer.EnsureNewLine();
 }
        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();
        }
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine($"({NodeName}");
     writer.Indent();
     Expression.ToString(writer);
     writer.Unindent();
     writer.WriteLine(")");
 }
Exemple #9
0
 public void ToString(NodeWriter writer)
 {
     foreach (var node in _nodes)
     {
         writer.EnsureNewLine();
         node.ToString(writer);
     }
 }
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine($"(grow_memory");
     writer.Indent();
     Expression.ToString(writer);
     writer.Unindent();
     writer.WriteLine(")");
 }
Exemple #11
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("br");
     writer.WriteLabelName(Target);
     writer.CloseNode();
     writer.EnsureNewLine();
 }
Exemple #12
0
 public sealed override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode(NodeName);
     writer.EnsureSpace();
     Expression.ToString(writer);
     writer.CloseNode();
 }
Exemple #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();
 }
Exemple #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(")");
 }
Exemple #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();
 }
Exemple #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();
 }
Exemple #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();
 }
Exemple #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();
 }
        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();
        }
Exemple #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?
 }
Exemple #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();
 }
Exemple #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();
        }
Exemple #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();
        }
Exemple #24
0
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine($"(current_memory)");
 }
Exemple #25
0
 public override void ToString(NodeWriter writer)
 {
     writer.WriteLine("(unreachable)");
 }
Exemple #26
0
 public abstract void ToString(NodeWriter writer);
Exemple #27
0
 public override void ToString(NodeWriter writer) => throw new System.NotImplementedException();