Пример #1
0
        /// <summary>
        /// Writes a string representation of this instruction to the given text writer.
        /// </summary>
        /// <param name="writer">
        /// The writer to which a representation of this instruction is written.
        /// </param>
        public override void Dump(TextWriter writer)
        {
            Op.Dump(writer);
            writer.Write(" (result: ");
            DumpHelpers.DumpWasmType(Type, writer);
            writer.Write(")");
            var indentedWriter = DumpHelpers.CreateIndentedTextWriter(writer);

            foreach (var instr in IfBranch)
            {
                indentedWriter.WriteLine();
                instr.Dump(indentedWriter);
            }
            writer.WriteLine();
            if (HasElseBranch)
            {
                writer.Write("else");
                foreach (var instr in ElseBranch)
                {
                    indentedWriter.WriteLine();
                    instr.Dump(indentedWriter);
                }
                writer.WriteLine();
            }
            writer.Write("end");
        }
Пример #2
0
        protected override Value RealCalc(Scope scope)
        {
            if (Op != null)
            {
                ExprOp locus = null;
                try
                {
                    return(Op.Calc(scope, locus));
                }
                catch
                {
                    if (locus != null)
                    {
                        string currentContext = ErrorContext.Current.GetContext();

                        ErrorContext.Current.AddErrorContext("While evaluating value expression:");
                        ErrorContext.Current.AddErrorContext(ErrorContext.OpContext(Op, locus));

                        if (Logger.Current.ShowInfo())
                        {
                            ErrorContext.Current.AddErrorContext("The value expression tree was:");
                            ErrorContext.Current.AddErrorContext(Op.Dump());
                        }

                        if (!String.IsNullOrEmpty(currentContext))
                        {
                            ErrorContext.Current.AddErrorContext(currentContext);
                        }
                    }
                    throw;
                }
            }
            return(new Value());
        }
Пример #3
0
 /// <summary>
 /// Writes a string representation of this instruction to the given text writer.
 /// </summary>
 /// <param name="writer">
 /// The writer to which a representation of this instruction is written.
 /// </param>
 public override void Dump(TextWriter writer)
 {
     Op.Dump(writer);
     writer.Write(" offset=");
     writer.Write(Offset);
     writer.Write(" align=");
     writer.Write(Alignment);
 }
Пример #4
0
 /// <summary>
 /// Writes a string representation of this instruction to the given text writer.
 /// </summary>
 /// <param name="Writer">
 /// The writer to which a representation of this instruction is written.
 /// </param>
 public override void Dump(TextWriter Writer)
 {
     Op.Dump(Writer);
     Writer.Write(" ");
     Writer.Write(TypeIndex);
     if (Reserved != 0)
     {
         Writer.Write(" (reserved=");
         Writer.Write(Reserved);
         Writer.Write(")");
     }
 }
Пример #5
0
        /// <summary>
        /// Writes a string representation of this instruction to the given text writer.
        /// </summary>
        /// <param name="writer">
        /// The writer to which a representation of this instruction is written.
        /// </param>
        public override void Dump(TextWriter writer)
        {
            Op.Dump(writer);
            writer.Write(" default=");
            writer.Write(DefaultTarget);
            var indentedWriter = DumpHelpers.CreateIndentedTextWriter(writer);

            for (int i = 0; i < TargetTable.Count; i++)
            {
                indentedWriter.WriteLine();
                indentedWriter.Write(i);
                indentedWriter.Write(" -> ");
                indentedWriter.Write(TargetTable[i]);
            }
            writer.WriteLine();
        }
Пример #6
0
        /// <summary>
        /// Writes a string representation of this instruction to the given text writer.
        /// </summary>
        /// <param name="Writer">
        /// The writer to which a representation of this instruction is written.
        /// </param>
        public override void Dump(TextWriter Writer)
        {
            Op.Dump(Writer);
            Writer.Write(" (result: ");
            DumpHelpers.DumpWasmType(Type, Writer);
            Writer.Write(")");
            var indentedWriter = DumpHelpers.CreateIndentedTextWriter(Writer);

            foreach (var instr in Contents)
            {
                indentedWriter.WriteLine();
                instr.Dump(indentedWriter);
            }
            Writer.WriteLine();
            Writer.Write("end");
        }
Пример #7
0
 public override string Dump()
 {
     return(Op != null?Op.Dump() : base.Dump());
 }
Пример #8
0
 /// <summary>
 /// Writes a string representation of this instruction to the given text writer.
 /// </summary>
 /// <param name="Writer">
 /// The writer to which a representation of this instruction is written.
 /// </param>
 public override void Dump(TextWriter Writer)
 {
     Op.Dump(Writer);
     Writer.Write(" ");
     Writer.Write(Immediate);
 }