Browse Source

Fixed bug in C# parser: EndLocation was not set for some kinds of type references

pull/14/head
Daniel Grunwald 15 years ago
parent
commit
f79eed93ef
  1. 10
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  2. 10
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG

10
src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs

@ -1356,12 +1356,12 @@ out r, canBeUnbound); @@ -1356,12 +1356,12 @@ out r, canBeUnbound);
lexer.NextToken();
#line 711 "cs.ATG"
typeRef = new TypeReference("System.Object", true); typeRef.StartLocation = t.Location;
typeRef = new TypeReference("System.Object", true); typeRef.StartLocation = t.Location; typeRef.EndLocation = t.EndLocation;
} else if (la.kind == 108) {
lexer.NextToken();
#line 712 "cs.ATG"
typeRef = new TypeReference("System.String", true); typeRef.StartLocation = t.Location;
typeRef = new TypeReference("System.String", true); typeRef.StartLocation = t.Location; typeRef.EndLocation = t.EndLocation;
} else SynErr(157);
}
@ -1424,7 +1424,7 @@ out typeArguments, canBeUnbound); @@ -1424,7 +1424,7 @@ out typeArguments, canBeUnbound);
}
#line 2347 "cs.ATG"
typeRef.StartLocation = startLocation;
typeRef.StartLocation = startLocation; typeRef.EndLocation = t.EndLocation;
}
void MemberModifiers(
@ -2503,13 +2503,13 @@ out type, canBeUnbound); @@ -2503,13 +2503,13 @@ out type, canBeUnbound);
out name);
#line 587 "cs.ATG"
type = new TypeReference(name, true);
type = new TypeReference(name, true); type.StartLocation = startPos; type.EndLocation = t.EndLocation;
} else if (la.kind == 123) {
lexer.NextToken();
Expect(6);
#line 588 "cs.ATG"
pointer = 1; type = new TypeReference("System.Void", true);
pointer = 1; type = new TypeReference("System.Void", true); type.StartLocation = startPos; type.EndLocation = t.EndLocation;
} else SynErr(176);
#line 589 "cs.ATG"

10
src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG

@ -584,8 +584,8 @@ TypeWithRestriction<out TypeReference type, bool allowNullable, bool canBeUnboun @@ -584,8 +584,8 @@ TypeWithRestriction<out TypeReference type, bool allowNullable, bool canBeUnboun
.)
=
( ClassType<out type, canBeUnbound>
| SimpleType<out name> (. type = new TypeReference(name, true); .)
| "void" "*" (. pointer = 1; type = new TypeReference("System.Void", true); .)
| SimpleType<out name> (. type = new TypeReference(name, true); type.StartLocation = startPos; type.EndLocation = t.EndLocation; .)
| "void" "*" (. pointer = 1; type = new TypeReference("System.Void", true); type.StartLocation = startPos; type.EndLocation = t.EndLocation; .)
) (. List<int> r = new List<int>(); .)
[ IF (allowNullable && la.kind == Tokens.Question) NullableQuestionMark<ref type> ]
@ -708,8 +708,8 @@ ClassType<out TypeReference typeRef, bool canBeUnbound> @@ -708,8 +708,8 @@ ClassType<out TypeReference typeRef, bool canBeUnbound>
(. TypeReference r; typeRef = null; .)
=
TypeName<out r, canBeUnbound> (. typeRef = r; .)
| "object" (. typeRef = new TypeReference("System.Object", true); typeRef.StartLocation = t.Location; .)
| "string" (. typeRef = new TypeReference("System.String", true); typeRef.StartLocation = t.Location; .)
| "object" (. typeRef = new TypeReference("System.Object", true); typeRef.StartLocation = t.Location; typeRef.EndLocation = t.EndLocation; .)
| "string" (. typeRef = new TypeReference("System.String", true); typeRef.StartLocation = t.Location; typeRef.EndLocation = t.EndLocation; .)
.
IntegralType<out string name> (. name = ""; .)
@ -2344,7 +2344,7 @@ TypeName<out TypeReference typeRef, bool canBeUnbound> @@ -2344,7 +2344,7 @@ TypeName<out TypeReference typeRef, bool canBeUnbound>
[TypeArgumentList<out typeArguments, canBeUnbound>]
(. typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments); .)
}
(. typeRef.StartLocation = startLocation; .)
(. typeRef.StartLocation = startLocation; typeRef.EndLocation = t.EndLocation; .)
.

Loading…
Cancel
Save