protected IParameterDefinition[] GetModuleParameters(bool useParamInfo, ISignature signatureDefinition, int paramCount) { MethodDefinition/*?*/ moduleMethod = signatureDefinition as MethodDefinition; int paramIndex = 0; var parameters = new IParameterDefinition[paramCount]; while (paramIndex < paramCount) { bool dummyPinned; var customModifiers = this.GetCustomModifiers(out dummyPinned); byte currByte = this.SignatureMemoryReader.PeekByte(0); if (currByte == ElementType.Sentinel) { this.SignatureMemoryReader.SkipBytes(1); var requiredParameters = new IParameterDefinition[paramIndex]; for (int i = 0; i < paramIndex; i++) requiredParameters[i] = parameters[i]; return requiredParameters; } bool isByReference = false; ITypeReference/*?*/ typeReference; if (currByte == ElementType.TypedReference) { this.SignatureMemoryReader.SkipBytes(1); typeReference = this.PEFileToObjectModel.PlatformType.SystemTypedReference; } else { if (currByte == ElementType.ByReference) { this.SignatureMemoryReader.SkipBytes(1); isByReference = true; } typeReference = this.GetTypeReference(); } ParamInfo? paramInfo = useParamInfo ? this.GetParamInfo(paramIndex + 1) : null; IParameterDefinition moduleParameter; if (paramInfo.HasValue) { var paramArrayType = typeReference as IArrayTypeReference; moduleParameter = new ParameterWithMetadata(this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, moduleMethod, isByReference, (paramIndex == paramCount - 1) && paramArrayType != null && paramArrayType.IsVector, paramInfo.Value.ParamRowId, paramInfo.Value.ParamName, paramInfo.Value.ParamFlags); } else moduleParameter = new ParameterWithoutMetadata(this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, signatureDefinition, isByReference); parameters[paramIndex++] = moduleParameter; } return parameters; }
protected IModuleParameter[] GetModuleParameters( bool useParamInfo, ISignature signatureDefinition, int paramCount ) { MethodDefinition/*?*/ moduleMethod = signatureDefinition as MethodDefinition; int paramIndex = 0; List<IModuleParameter> moduleParamList = new List<IModuleParameter>(); while (paramIndex < paramCount) { bool dummyPinned; EnumerableArrayWrapper<CustomModifier, ICustomModifier> customModifiers = this.GetCustomModifiers(out dummyPinned); byte currByte = this.SignatureMemoryReader.PeekByte(0); if (currByte == ElementType.Sentinel) { this.SignatureMemoryReader.SkipBytes(1); break; } bool isByReference = false; IModuleTypeReference/*?*/ typeReference; if (currByte == ElementType.TypedReference) { this.SignatureMemoryReader.SkipBytes(1); typeReference = this.PEFileToObjectModel.SystemTypedReference; } else { if (currByte == ElementType.ByReference) { this.SignatureMemoryReader.SkipBytes(1); isByReference = true; } typeReference = this.GetTypeReference(); } ParamInfo? paramInfo = useParamInfo ? this.GetParamInfo(paramIndex + 1) : null; IModuleParameter moduleParameter; if (paramInfo.HasValue) { //^ assert moduleMethod != null; moduleParameter = new ParameterWithMetadata( this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, moduleMethod, isByReference, (paramIndex == paramCount - 1) && (typeReference is VectorType), paramInfo.Value.ParamRowId, paramInfo.Value.ParamName, paramInfo.Value.ParamFlags ); } else { moduleParameter = new ParameterWithoutMetadata( this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, signatureDefinition, isByReference ); } moduleParamList.Add(moduleParameter); paramIndex++; } return moduleParamList.ToArray(); }