Example #1
0
 public void PutSymbol(Symbol symbol)
 {
     if (moduleBeingBuilt != null)
     {
         writer.WriteUint(moduleBeingBuilt.GetFakeSymbolTokenForIL(moduleBeingBuilt.Translate(symbol)));
     }
 }
Example #2
0
            private MethodBody BOGUSDefineCtor(MethodSymbol methSym)
            {
                Compilation  myCompilation = ((SourceAssemblySymbol)methSym.ContainingAssembly).Compilation;
                MethodSymbol objCtor       = BOGUSFindObjCtor(myCompilation);

                ILBuilder builder = new ILBuilder();

                builder.PutOpCode(ILOpCode.Nop);
                builder.PutOpCode(ILOpCode.Ldarg_0);
                builder.PutOpCode(ILOpCode.Call, 0);
                builder.PutToken(moduleBeingBuilt.GetFakeSymbolTokenForIL(moduleBeingBuilt.Translate(objCtor)));
                builder.PutOpCode(ILOpCode.Nop);
                builder.PutOpCode(ILOpCode.Ret, -1);
                return(new MethodBody(
                           builder.Bits, builder.MaxStack,
                           methSym,
                           SpecializedCollections.EmptyEnumerable <LocalDefinition>(), null, ReadOnlyArray <LocalScope> .Empty));
            }
Example #3
0
        public void PutOpcode(Microsoft.Cci.OperationCode opcode, Symbol symbol)
        {
            PutOpcode(opcode);

            var opcodeInfo = Microsoft.Cci.PeWriter.OperationCodeInfo(opcode);

            switch (opcodeInfo.OperandType)
            {
            case OperandType.InlineField:
            case OperandType.InlineMethod:
            case OperandType.InlineTok:
            case OperandType.InlineType:
                writer.WriteUint(moduleBeingBuilt.GetFakeSymbolTokenForIL(moduleBeingBuilt.Translate(symbol)));
                break;

            default:
                throw new NotImplementedException();
            }
        }