Browse Source

NRefactory.VB: fixed UsingStatementTests

newNRvisualizers
Siegfried Pammer 15 years ago
parent
commit
9e536aa039
  1. 8
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/UsingStatementTests.cs
  2. 4
      ICSharpCode.NRefactory.VB/Parser/Parser.cs
  3. 2
      ICSharpCode.NRefactory.VB/Parser/vb.atg

8
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/UsingStatementTests.cs

@ -12,9 +12,8 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[TestFixture] [TestFixture]
public class UsingStatementTests public class UsingStatementTests
{ {
#region VB.NET
[Test] [Test]
public void VBNetUsingStatementTest() public void UsingStatement()
{ {
string usingText = @" string usingText = @"
Using nf As New System.Drawing.Font(""Arial"", 12.0F, FontStyle.Bold) Using nf As New System.Drawing.Font(""Arial"", 12.0F, FontStyle.Bold)
@ -25,7 +24,7 @@ End Using";
// TODO : Extend test. // TODO : Extend test.
} }
[Test] [Test]
public void VBNetUsingStatementTest2() public void UsingStatement2()
{ {
string usingText = @" string usingText = @"
Using nf As Font = New Font() Using nf As Font = New Font()
@ -35,7 +34,7 @@ End Using";
// TODO : Extend test. // TODO : Extend test.
} }
[Test] [Test]
public void VBNetUsingStatementTest3() public void UsingStatement3()
{ {
string usingText = @" string usingText = @"
Using nf As New Font(), nf2 As New List(Of Font)(), nf3 = Nothing Using nf As New Font(), nf2 As New List(Of Font)(), nf3 = Nothing
@ -44,6 +43,5 @@ End Using";
UsingStatement usingStmt = ParseUtil.ParseStatement<UsingStatement>(usingText); UsingStatement usingStmt = ParseUtil.ParseStatement<UsingStatement>(usingText);
// TODO : Extend test. // TODO : Extend test.
} }
#endregion
} }
} }

4
ICSharpCode.NRefactory.VB/Parser/Parser.cs

@ -4883,10 +4883,12 @@ partial class VBParser
Get(); Get();
VariableDeclarator(resourceAquisition.Variables); VariableDeclarator(resourceAquisition.Variables);
} }
EndOfStmt();
Block(out block); Block(out block);
statement = new UsingStatement(resourceAquisition, block); statement = new UsingStatement(resourceAquisition, block);
} else if (StartOf(24)) { } else if (StartOf(24)) {
Expr(out expr); Expr(out expr);
EndOfStmt();
Block(out block); Block(out block);
statement = new UsingStatement(new ExpressionStatement(expr), block); statement = new UsingStatement(new ExpressionStatement(expr), block);
} else SynErr(313); } else SynErr(313);
@ -5113,7 +5115,7 @@ partial class VBParser
new BitArray(new int[] {0, 256, 0, -1602223552, 805306368, 1589117120, 262528, 3072}), new BitArray(new int[] {0, 256, 0, -1602223552, 805306368, 1589117120, 262528, 3072}),
new BitArray(new int[] {0, 0, 1048576, 524416, 134234112, 0, 131072, 0}), new BitArray(new int[] {0, 0, 1048576, 524416, 134234112, 0, 131072, 0}),
new BitArray(new int[] {-66123780, 1174405164, -51384097, 1175465247, -1030969178, 17106228, -97448432, 67}), new BitArray(new int[] {-66123780, 1174405164, -51384097, 1175465247, -1030969178, 17106228, -97448432, 67}),
new BitArray(new int[] {1014958078, -956301272, -1051937, 1467137823, -1030969162, -1593504476, -21406146, 711}), new BitArray(new int[] {7340034, -2147483648, 0, 32768, 0, 0, 0, 0}),
new BitArray(new int[] {-66123780, 1174405164, -51384097, -972018401, -1030969178, 17106228, -97186288, 67}), new BitArray(new int[] {-66123780, 1174405164, -51384097, -972018401, -1030969178, 17106228, -97186288, 67}),
new BitArray(new int[] {0, 0, 0, 536870912, 1, 436207616, 0, 0}), new BitArray(new int[] {0, 0, 0, 536870912, 1, 436207616, 0, 0}),
new BitArray(new int[] {0, 256, 0, 536870912, 0, 436207616, 64, 0}), new BitArray(new int[] {0, 256, 0, 536870912, 0, 436207616, 64, 0}),

2
ICSharpCode.NRefactory.VB/Parser/vb.atg

@ -3423,9 +3423,11 @@ UsingStatement<out Statement statement>
new LocalVariableDeclaration(Modifiers.None); .) new LocalVariableDeclaration(Modifiers.None); .)
VariableDeclarator<resourceAquisition.Variables> VariableDeclarator<resourceAquisition.Variables>
{ "," VariableDeclarator<resourceAquisition.Variables> } { "," VariableDeclarator<resourceAquisition.Variables> }
EndOfStmt
Block<out block> Block<out block>
(. statement = new UsingStatement(resourceAquisition, block); .) (. statement = new UsingStatement(resourceAquisition, block); .)
| Expr<out expr> | Expr<out expr>
EndOfStmt
Block<out block> Block<out block>
(. statement = new UsingStatement(new ExpressionStatement(expr), block); .) (. statement = new UsingStatement(new ExpressionStatement(expr), block); .)
) )

Loading…
Cancel
Save