Browse Source

Fixed SD2-419:C# Parser bug (methodBase is ConstructorInfo ? #ctor : methodBase.Name).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@466 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 20 years ago
parent
commit
452b741835
  1. 1994
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  2. 65
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
  3. 2
      src/Libraries/NRefactory/Test/Parser/Expressions/ConditionalExpressionTests.cs

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

File diff suppressed because it is too large Load Diff

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

@ -954,7 +954,9 @@ Type<out TypeReference type> @@ -954,7 +954,9 @@ Type<out TypeReference type>
=
( ClassType<out type>
| SimpleType<out name> (. type = new TypeReference(name); .)
[ NullableQuestionMark<ref type> ]
| "void" "*" (. pointer = 1; type = new TypeReference("void"); .)
) (. List<int> r = new List<int>(); .)
@ -970,6 +972,32 @@ Type<out TypeReference type> @@ -970,6 +972,32 @@ Type<out TypeReference type>
.)
.
TypeWONullableQuestionMark<out TypeReference type>
(.
string name;
int pointer = 0;
type = null;
.)
=
( ClassTypeWONullableQuestionMark<out type>
| SimpleType<out name> (. type = new TypeReference(name); .)
| "void" "*" (. pointer = 1; type = new TypeReference("void"); .)
) (. List<int> r = new List<int>(); .)
{ IF (IsPointerOrDims()) (. int i = 0; .)
( "*" (. ++pointer; .)
| "[" { "," (. ++i; .) } "]" (. r.Add(i); .)
)
}
(. if (type != null) {
type.RankSpecifier = r.ToArray();
type.PointerNestingLevel = pointer;
}
.)
.
NonArrayType<out TypeReference type>
(.
string name;
@ -979,7 +1007,7 @@ NonArrayType<out TypeReference type> @@ -979,7 +1007,7 @@ NonArrayType<out TypeReference type>
=
( ClassType<out type>
| SimpleType<out name> (. type = new TypeReference(name); .)
[ NullableQuestionMark<ref type> ]
[ NullableQuestionMark<ref type> ]
| "void" "*" (. pointer = 1; type = new TypeReference("void"); .)
)
@ -1078,6 +1106,14 @@ ClassType<out TypeReference typeRef> @@ -1078,6 +1106,14 @@ ClassType<out TypeReference typeRef>
| "string" (. typeRef = new TypeReference("string"); .)
.
ClassTypeWONullableQuestionMark<out TypeReference typeRef>
(. TypeReference r; typeRef = null; .)
=
TypeNameWONullableQuestionMark<out r> (. typeRef = r; .)
| "object" (. typeRef = new TypeReference("object"); .)
| "string" (. typeRef = new TypeReference("string"); .)
.
IntegralType<out string name> (. name = ""; .)
=
"sbyte" (. name = "sbyte"; .)
@ -2244,7 +2280,7 @@ RelationalExpr<ref Expression outExpr> @@ -2244,7 +2280,7 @@ RelationalExpr<ref Expression outExpr>
"is" (. op = BinaryOperatorType.TypeCheck; .)
| "as" (. op = BinaryOperatorType.AsCast; .)
)
Type<out type> (. outExpr = new BinaryOperatorExpression(outExpr, op, new TypeReferenceExpression(type)); .)
TypeWONullableQuestionMark<out type> (. outExpr = new BinaryOperatorExpression(outExpr, op, new TypeReferenceExpression(type)); .)
}
.
@ -2324,6 +2360,31 @@ TypeName<out TypeReference typeRef> @@ -2324,6 +2360,31 @@ TypeName<out TypeReference typeRef>
[ NullableQuestionMark<ref typeRef> ]
.
TypeNameWONullableQuestionMark<out TypeReference typeRef>
(. List<TypeReference> typeArguments = null;
string alias = null;
string qualident;
.)
=
[ IF (la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon)
ident (. alias = t.val; .)
"::"
]
Qualident<out qualident>
[ TypeArgumentList<out typeArguments> ]
(.
if (alias == null) {
typeRef = new TypeReference(qualident, typeArguments);
} else if (alias == "global") {
typeRef = new TypeReference(qualident, typeArguments);
typeRef.IsGlobal = true;
} else {
typeRef = new TypeReference(alias + "." + qualident, typeArguments);
}
.)
.
NullableQuestionMark<ref TypeReference typeRef>
(. List<TypeReference> typeArguments = new List<TypeReference>(1); .)
=

2
src/Libraries/NRefactory/Test/Parser/Expressions/ConditionalExpressionTests.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>

Loading…
Cancel
Save