From f79eed93ef93ef8302111c8d2df1aa8e25f11e5a Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 10 Nov 2010 21:12:07 +0100 Subject: [PATCH] Fixed bug in C# parser: EndLocation was not set for some kinds of type references --- .../NRefactory/Project/Src/Parser/CSharp/Parser.cs | 10 +++++----- .../NRefactory/Project/Src/Parser/CSharp/cs.ATG | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs index cb4be72288..89562922a8 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs @@ -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); } #line 2347 "cs.ATG" - typeRef.StartLocation = startLocation; + typeRef.StartLocation = startLocation; typeRef.EndLocation = t.EndLocation; } void MemberModifiers( @@ -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" diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG index d2b7522fd0..f95c0f01af 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG @@ -584,8 +584,8 @@ TypeWithRestriction - | SimpleType (. type = new TypeReference(name, true); .) - | "void" "*" (. pointer = 1; type = new TypeReference("System.Void", true); .) + | SimpleType (. 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 r = new List(); .) [ IF (allowNullable && la.kind == Tokens.Question) NullableQuestionMark ] @@ -708,8 +708,8 @@ ClassType (. TypeReference r; typeRef = null; .) = TypeName (. 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 (. name = ""; .) @@ -2344,7 +2344,7 @@ TypeName [TypeArgumentList] (. typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments); .) } - (. typeRef.StartLocation = startLocation; .) + (. typeRef.StartLocation = startLocation; typeRef.EndLocation = t.EndLocation; .) .