Exemple #1
0
 /// <summary>
 /// Write out a line instruction to the CIL file.
 /// </summary>
 /// <param name="output">The CIL instruction writer to use to write this instruction.</param>
 internal override void Write(CILWriter output)
 {
     if (output.Debug) {
         string lineDetails = startLine + ", " + startCol;
         if (hasEnd) {
             lineDetails += ", " + endLine + ", " + endCol;
             if (sourceFile != null) {
                 lineDetails += ", " + sourceFile.Name;
             }
         }
         output.WriteLine(".line " + lineDetails);
     }
 }
Exemple #2
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine(".assembly " + name + " { }");
 }
Exemple #3
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine(opcode[instr] + " " + val);
 }
Exemple #4
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine("ldc.r4 " + fVal);
 }
Exemple #5
0
 internal override void Write(CILWriter output)
 {
     if (twoByteInstr) {
         output.WriteLine(FEopcode[instr]);
     } else {
         output.WriteLine(opcode[instr]);
     }
 }
Exemple #6
0
 internal override void Write(CILWriter output)
 {
     output.Write("  .field ");
     if (hasOffset) {
         output.Write("[ {0} ] ", offset);
     }
     WriteFlags(output, flags);
     if (marshalType != null) {
         output.Write("marshal ");
         marshalType.Write(output);
     }
     type.WriteType(output);
     output.Write(" " + name);
     if (initVal != null) {
         initVal.Write(output);
     } else if (constVal != null) {
         constVal.Write(output);
     }
     output.WriteLine();
 }
Exemple #7
0
 internal override void Write(CILWriter output)
 {
     output.Write(GetInstrString());
     field.WriteType(output);
     output.WriteLine();
 }
Exemple #8
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine("Label" + num + ":");
 }
Exemple #9
0
        internal override void Write(CILWriter output)
        {
            output.Write(".class ");
            WriteFlags(output);
            if ((nameSpace != null) && (nameSpace != "")) {
                output.Write(nameSpace + ".");
            }
            output.WriteLine(name);
            if (superType != null) {
                output.Write("    extends ");
                superType.WriteName(output);
            }
            if (interfaces.Count > 0) {
                output.Write("  implements ");
                for (int i=0; i < interfaces.Count; i++) {
                    InterfaceImpl impl = (InterfaceImpl)interfaces[i];
                    if (i > 0) output.Write(", ");
                    impl.TheInterface().WriteName(output);
                }
            }
            output.WriteLine();
            output.WriteLine("{");
            for (int i=0; i < fields.Count; i++) {
                ((Field)fields[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < methods.Count; i++) {
                ((MethodDef)methods[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < methodImpls.Count; i++) {
                ((MethodImpl)methodImpls[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < events.Count; i++) {
                ((Event)events[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < properties.Count; i++) {
                ((Property)properties[i]).Write(output);
                output.WriteLine();
            }

            output.WriteLine("}");
            output.WriteLine();
        }
Exemple #10
0
 internal override void Write(CILWriter output)
 {
     output.Write(GetInstrString());
     theType.WriteName(output);
     output.WriteLine();
 }
Exemple #11
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine(".emitbyte " + Hex.Byte(byteVal));  // ???? CHECK THIS ????
 }
Exemple #12
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine("ldstr \"" + val + "\"");
 }
Exemple #13
0
 internal override void Write(CILWriter output)
 {
     output.Write(GetInstrString());
     signature.Write(output);
     output.WriteLine();
 }
Exemple #14
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine(GetInstrString() + dest.GetInstName());
 }
Exemple #15
0
 internal override void Write(CILWriter output)
 {
     output.Write("  .method ");
     WriteFlags(output, methFlags);
     sig.Write(output);
     output.Write(" " + name + "(");
     if (parList != null) {
         for (int i=0; i < parList.Length; i++) {
             parList[i].Write(output);
             if (i < parList.Length-1) {
                 output.Write(", ");
             }
         }
     }
     output.Write(") ");
     uint codeType = implFlags & (uint)0x11;
     if (codeType == 0) {
         output.Write("cil ");
     } else if (codeType == 1) {
         output.Write("native ");
     } else if (codeType == 3) {
         output.Write("runtime ");
     }
     if ((implFlags & (uint)ImplAttr.Unmanaged) == 0) {
         output.Write("managed ");
     } else {
         output.Write("unmanaged ");
     }
     if ((implFlags & (uint)ImplAttr.ForwardRef) != 0) {
         output.Write("forwardref ");
     }
     if ((implFlags & (uint)ImplAttr.InternalCall) != 0) {
         output.Write("internalcall ");
     }
     if ((implFlags & (uint)ImplAttr.Synchronized) != 0) {
         output.Write("synchronized ");
     }
     if ((implFlags & (uint)ImplAttr.NoInLining) != 0) {
         output.Write("noinlining ");
     }
     output.WriteLine(" {");
     if ((locals != null) && (locals.Length > 0)) {
         output.Write("      .locals (");
         for (int i=0; i < locals.Length; i++) {
             if (i > 0) {
                 output.Write("              ");
             }
             locals[i].Write(output);
             if (i < locals.Length-1) {
                 output.WriteLine(",");
             }
         }
         output.WriteLine(" )");
     }
     if (entryPoint) {
         output.WriteLine("      .entrypoint");
     }
     if (code != null) code.Write(output);
     output.WriteLine("  }");
 }
Exemple #16
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine("ldc.i8 " + val);
 }