コード例 #1
0
        private AnalysisNet.IInstruction ProcessCreateObject(Cecil.Cil.Instruction op)
        {
            Cecil.MethodReference cciMethod = op.Operand as Cecil.MethodReference;
            AnalysisNet.Types.IMethodReference ourMethod = typeExtractor.ExtractMethod(cciMethod);

            if (ourMethod.ContainingType is FakeArrayType fakeArrayType)
            {
                bool withLowerBounds = ourMethod.Parameters.Count > fakeArrayType.Type.Rank;
                return(CreateArray((uint)op.Offset, fakeArrayType.Type, withLowerBounds));
            }

            AnalysisNetBytecode.CreateObjectInstruction instruction = new AnalysisNetBytecode.CreateObjectInstruction((uint)op.Offset, ourMethod);
            return(instruction);
        }
コード例 #2
0
            public AnalysisNet.Types.IGenericParameterReference GetGenericParameter(Cecil.GenericParameter cecilParameter)
            {
                Cecil.IGenericParameterProvider owner = cecilParameter.Owner;
                if (genericParamsMap.TryGetValue(owner, out GenericParameterMap map))
                {
                    return(map[cecilParameter.Position]);
                }

                // populates map
                if (cecilParameter.Type == Cecil.GenericParameterType.Method)
                {
                    typeExtractor.ExtractMethod(owner as Cecil.MethodReference);
                }
                else
                {
                    // check my assumption
                    if ((owner is Cecil.GenericInstanceType))
                    {
                        throw new Exception();
                    }

                    typeExtractor.ExtractType(owner as Cecil.TypeReference);
                }

                map = genericParamsMap[owner];
                return(map[cecilParameter.Position]);
            }