Skip to content

Commit

Permalink
Merge pull request 0xd4d#387 from yyjdelete/patch
Browse files Browse the repository at this point in the history
'=' should be an vaild char for TypeNameParser.ReadTypeRefNoAssembly()
  • Loading branch information
wtfsck committed Aug 15, 2020
2 parents a842977 + 7a01346 commit 0ddabb7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/DotNet/TypeNameParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ protected TypeRef ReadTypeRefAndNestedNoAssembly(char nestedChar) {
protected TypeRef ReadTypeRefNoAssembly() {
// White space is important here. Any white space before the comma/EOF must be
// parsed as part of the name.
GetNamespaceAndName(ReadId(false), out var ns, out var name);
GetNamespaceAndName(ReadId(false, false), out var ns, out var name);
return ownerModule.UpdateRowId(new TypeRefUser(ownerModule, ns, name));
}

Expand Down Expand Up @@ -455,13 +455,13 @@ internal int ReadInt32() {
}
}

internal string ReadId() => ReadId(true);
internal string ReadId() => ReadId(true, true);

internal string ReadId(bool ignoreWhiteSpace) {
internal string ReadId(bool ignoreWhiteSpace, bool ignoreEqualSign) {
SkipWhite();
var sb = new StringBuilder();
int c;
while ((c = GetIdChar(ignoreWhiteSpace)) != -1)
while ((c = GetIdChar(ignoreWhiteSpace, ignoreEqualSign)) != -1)
sb.Append((char)c);
Verify(sb.Length > 0, "Expected an id");
return sb.ToString();
Expand All @@ -481,7 +481,8 @@ internal string ReadId(bool ignoreWhiteSpace) {
/// Gets the next ID char or <c>-1</c> if no more ID chars
/// </summary>
/// <param name="ignoreWhiteSpace"><c>true</c> if white space should be ignored</param>
internal abstract int GetIdChar(bool ignoreWhiteSpace);
/// <param name="ignoreEqualSign"><c>true</c> if equal sign '=' should be ignored</param>
internal abstract int GetIdChar(bool ignoreWhiteSpace, bool ignoreEqualSign);
}

/// <summary>
Expand Down Expand Up @@ -824,7 +825,7 @@ int GetAsmNameChar() {
}
}

internal override int GetIdChar(bool ignoreWhiteSpace) {
internal override int GetIdChar(bool ignoreWhiteSpace, bool ignoreEqualSign) {
int c = PeekChar();
if (c == -1)
return -1;
Expand All @@ -841,7 +842,7 @@ internal override int GetIdChar(bool ignoreWhiteSpace) {
case '*':
case '[':
case ']':
case '=':
case '=' when ignoreEqualSign:
return -1;

default:
Expand Down

0 comments on commit 0ddabb7

Please sign in to comment.