Browse Source

Fixed forum-8452: VB parser bug

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1465 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
8d441d6f05
  1. 1083
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  2. 4
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  3. 22
      src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs

1083
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

4
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -1820,6 +1820,10 @@ InvocationExpression<ref Expression pexpr>
"(" (. Point start = t.Location; .) "(" (. Point start = t.Location; .)
( "Of" ( "Of"
TypeName<out type> (. if (type != null) typeParameters.Add(type); .) TypeName<out type> (. if (type != null) typeParameters.Add(type); .)
{
","
TypeName<out type> (. if (type != null) typeParameters.Add(type); .)
}
")" ")"
( (
"." Identifier "." Identifier

22
src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs

@ -32,6 +32,16 @@ namespace ICSharpCode.NRefactory.Tests.AST
Assert.AreEqual("System.Char", expr.TypeArguments[0].SystemType); Assert.AreEqual("System.Char", expr.TypeArguments[0].SystemType);
} }
void CheckGenericInvoke2(InvocationExpression expr)
{
Assert.AreEqual(0, expr.Arguments.Count);
Assert.IsTrue(expr.TargetObject is IdentifierExpression);
Assert.AreEqual("myMethod", ((IdentifierExpression)expr.TargetObject).Identifier);
Assert.AreEqual(2, expr.TypeArguments.Count);
Assert.AreEqual("T", expr.TypeArguments[0].SystemType);
Assert.AreEqual("System.Boolean", expr.TypeArguments[1].SystemType);
}
#region C# #region C#
[Test] [Test]
@ -46,6 +56,12 @@ namespace ICSharpCode.NRefactory.Tests.AST
CheckGenericInvoke(ParseUtilCSharp.ParseExpression<InvocationExpression>("myMethod<char>('a')")); CheckGenericInvoke(ParseUtilCSharp.ParseExpression<InvocationExpression>("myMethod<char>('a')"));
} }
[Test]
public void CSharpGenericInvocation2ExpressionTest()
{
CheckGenericInvoke2(ParseUtilCSharp.ParseExpression<InvocationExpression>("myMethod<T,bool>()"));
}
[Test] [Test]
public void CSharpInvalidNestedInvocationExpressionTest() public void CSharpInvalidNestedInvocationExpressionTest()
{ {
@ -75,6 +91,12 @@ namespace ICSharpCode.NRefactory.Tests.AST
CheckGenericInvoke(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod(Of Char)(\"a\"c)")); CheckGenericInvoke(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod(Of Char)(\"a\"c)"));
} }
[Test]
public void VBNetGenericInvocation2ExpressionTest()
{
CheckGenericInvoke2(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod(Of T, Boolean)()"));
}
[Test] [Test]
public void PrimitiveExpression1Test() public void PrimitiveExpression1Test()
{ {

Loading…
Cancel
Save