public CLRSigParamOrRetType(CLRSignatureParser parser, bool allowSentinel) { CustomMods = CLRSigType.ReadCustomMods(parser); CLRSignatureParser.Token token = parser.NextToken(); if (token == CLRSignatureParser.Token.TYPEDBYREF) { TypeOfType = TypeOfTypeEnum.TypedByRef; parser.ConsumeToken(); } else if (token == CLRSignatureParser.Token.SENTINEL) { if (!allowSentinel) throw new ParseFailedException("Malformed signature"); TypeOfType = TypeOfTypeEnum.Sentinel; parser.ConsumeToken(); } else { bool allowVoid = AllowVoid; if (token == CLRSignatureParser.Token.BYREF) { TypeOfType = TypeOfTypeEnum.ByRef; token = parser.NextToken(); parser.ConsumeToken(); allowVoid = false; } else TypeOfType = TypeOfTypeEnum.Value; Type = CLRSigType.Parse(parser, allowVoid); } }
public CLRSigLocalVarSig(CLRSignatureParser parser) { if (parser.NextToken() != CLRSignatureParser.Token.LOCAL_SIG) throw new ParseFailedException("Invalid local var sig"); parser.ConsumeToken(); uint numLocals = parser.ReadCompressedUInt(); LocalVars = new CLRSigLocalVar[numLocals]; for (uint i = 0; i < numLocals; i++) LocalVars[i] = new CLRSigLocalVar(parser); }
public CLRSigMethodSpec(CLRSignatureParser parser) { if (parser.NextToken() != CLRSignatureParser.Token.GENERICINST) throw new ParseFailedException("Malformed method spec"); parser.ConsumeToken(); uint numGenericParams = parser.ReadCompressedUInt(); Types = new CLRSigType[numGenericParams]; for (uint i = 0; i < numGenericParams; i++) { Types[i] = CLRSigType.Parse(parser, false); } }
public CLRSigPropertySig(CLRSignatureParser parser) { CLRSignatureParser.Token headToken = parser.NextToken(); parser.ConsumeToken(); if (headToken == CLRSignatureParser.Token.PROPERTY_HASTHIS) HasThis = true; else if (headToken == CLRSignatureParser.Token.PROPERTY) HasThis = false; else throw new ParseFailedException("Malformed PropertySig"); uint paramCount = parser.ReadCompressedUInt(); CustomMods = CLRSigType.ReadCustomMods(parser); Type = CLRSigType.Parse(parser, false); Parameters = new CLRSigParamType[paramCount]; for (uint i = 0; i < paramCount; i++) Parameters[i] = new CLRSigParamType(parser, false); }