Browse Source

Fixed SD2-600 (Can't convert for loop). VB parser now accepts zero as lower array bound.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@871 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
e8a8828662
  1. 3
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj
  2. 165
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  3. 1345
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  4. 22
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  5. 2
      src/Libraries/NRefactory/Project/Src/Parser/Visitors/CSharpToVBNetConvertVisitor.cs
  6. 1
      src/Libraries/NRefactory/Test/NRefactoryTests.csproj
  7. 89
      src/Libraries/NRefactory/Test/Output/VBNet/ConverterTest.cs
  8. 6
      src/Libraries/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs
  9. 16
      src/Libraries/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs

3
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj

@ -32,9 +32,6 @@ @@ -32,9 +32,6 @@
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<Reference Include="MbUnit.Framework" />
<Reference Include="MbUnit.Framework" />
<Reference Include="MbUnit.Framework" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\AssemblyInfo.cs" />

165
src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -26,7 +26,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
NodeTracker nodeTracker;
TypeDeclaration currentType;
Stack exitTokenStack = new Stack();
Stack<int> exitTokenStack = new Stack<int>();
public string Text {
get {
@ -120,7 +120,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -120,7 +120,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
case "System.SByte":
return "SByte";
}
return typeString;
return null;
}
public object Visit(TypeReference typeReference, object data)
@ -141,8 +141,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -141,8 +141,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
if (typeReference.Type == null || typeReference.Type.Length ==0) {
outputFormatter.PrintText("Void");
} else {
if (typeReference.SystemType.Length > 0) {
outputFormatter.PrintText(ConvertTypeString(typeReference.SystemType));
string shortTypeName = ConvertTypeString(typeReference.SystemType);
if (shortTypeName != null) {
outputFormatter.PrintText(shortTypeName);
} else {
outputFormatter.PrintIdentifier(typeReference.Type);
}
@ -1017,11 +1018,31 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1017,11 +1018,31 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
#region Statements
public object Visit(BlockStatement blockStatement, object data)
{
OnBlock(blockStatement.Children);
VisitStatementList(blockStatement.Children);
return null;
}
void OnBlock(ArrayList statements)
void PrintIndentedBlock(Statement stmt)
{
outputFormatter.IndentationLevel += 1;
if (stmt is BlockStatement) {
nodeTracker.TrackedVisit(stmt, null);
} else {
outputFormatter.Indent();
nodeTracker.TrackedVisit(stmt, null);
outputFormatter.NewLine();
}
outputFormatter.IndentationLevel -= 1;
}
void PrintIndentedBlock(ArrayList statements)
{
outputFormatter.IndentationLevel += 1;
VisitStatementList(statements);
outputFormatter.IndentationLevel -= 1;
}
void VisitStatementList(ArrayList statements)
{
foreach (Statement stmt in statements) {
if (stmt is BlockStatement) {
@ -1085,7 +1106,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1085,7 +1106,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object Visit(OnErrorStatement onErrorStatement, object data)
{
// TODO: implement me!
outputFormatter.PrintToken(Tokens.On);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Error);
outputFormatter.Space();
nodeTracker.TrackedVisit(onErrorStatement.EmbeddedStatement, data);
return null;
}
@ -1137,7 +1162,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1137,7 +1162,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
{
Debug.Assert(yieldStatement != null);
Debug.Assert(yieldStatement.Statement != null);
// TODO: yieldStatement
errors.Error(-1, -1, "Yield is not supported in Visual Basic");
return null;
}
@ -1159,9 +1184,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1159,9 +1184,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Then);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
OnBlock(ifElseStatement.TrueStatement);
--outputFormatter.IndentationLevel;
PrintIndentedBlock(ifElseStatement.TrueStatement);
foreach (ElseIfSection elseIfSection in ifElseStatement.ElseIfSections) {
nodeTracker.TrackedVisit(elseIfSection, data);
@ -1171,9 +1194,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1171,9 +1194,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.Else);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
OnBlock(ifElseStatement.FalseStatement);
--outputFormatter.IndentationLevel;
PrintIndentedBlock(ifElseStatement.FalseStatement);
}
outputFormatter.Indent();
@ -1191,24 +1212,24 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1191,24 +1212,24 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Then);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
outputFormatter.Indent();
nodeTracker.TrackedVisit(elseIfSection.EmbeddedStatement, data);
outputFormatter.NewLine();
--outputFormatter.IndentationLevel;
PrintIndentedBlock(elseIfSection.EmbeddedStatement);
return null;
}
public object Visit(ForStatement forStatement, object data)
{ // Is converted to {initializer} while <Condition> {Embedded} {Iterators} end while
{
// Is converted to {initializer} while <Condition> {Embedded} {Iterators} end while
exitTokenStack.Push(Tokens.While);
outputFormatter.NewLine();
bool isFirstLine = true;
foreach (INode node in forStatement.Initializers) {
outputFormatter.Indent();
if (!isFirstLine)
outputFormatter.Indent();
isFirstLine = false;
nodeTracker.TrackedVisit(node, data);
outputFormatter.NewLine();
}
outputFormatter.Indent();
if (!isFirstLine)
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.While);
outputFormatter.Space();
if (forStatement.Condition.IsNull) {
@ -1218,21 +1239,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1218,21 +1239,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
nodeTracker.TrackedVisit(forStatement.EmbeddedStatement, data);
foreach (Statement stmt in forStatement.Iterator) {
outputFormatter.Indent();
nodeTracker.TrackedVisit(stmt, data);
outputFormatter.NewLine();
}
--outputFormatter.IndentationLevel;
PrintIndentedBlock(forStatement.EmbeddedStatement);
PrintIndentedBlock(forStatement.Iterator);
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.While);
outputFormatter.NewLine();
exitTokenStack.Pop();
return null;
}
@ -1280,14 +1293,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1280,14 +1293,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
this.AppendCommaSeparatedList(switchSection.SwitchLabels);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
PrintIndentedBlock(switchSection.Children);
foreach (Statement stmt in switchSection.Children) {
outputFormatter.Indent();
nodeTracker.TrackedVisit(stmt, data);
outputFormatter.NewLine();
}
--outputFormatter.IndentationLevel;
return null;
}
@ -1339,7 +1346,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1339,7 +1346,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Exit);
if (exitTokenStack.Count > 0) {
outputFormatter.Space();
outputFormatter.PrintToken((int)exitTokenStack.Peek());
outputFormatter.PrintToken(exitTokenStack.Peek());
}
return null;
}
@ -1382,7 +1389,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1382,7 +1389,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
} else {
nodeTracker.TrackedVisit(gotoCaseStatement.Expression, null);
}
outputFormatter.NewLine();
return null;
}
@ -1417,15 +1423,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1417,15 +1423,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
if (doLoopStatement.EmbeddedStatement is BlockStatement) {
nodeTracker.TrackedVisit(doLoopStatement.EmbeddedStatement, false);
} else {
outputFormatter.Indent();
nodeTracker.TrackedVisit(doLoopStatement.EmbeddedStatement, data);
outputFormatter.NewLine();
}
--outputFormatter.IndentationLevel;
PrintIndentedBlock(doLoopStatement.EmbeddedStatement);
outputFormatter.Indent();
if (doLoopStatement.ConditionType == ConditionType.While) {
@ -1478,15 +1476,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1478,15 +1476,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
nodeTracker.TrackedVisit(foreachStatement.Expression, data);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
if (foreachStatement.EmbeddedStatement is BlockStatement) {
nodeTracker.TrackedVisit(foreachStatement.EmbeddedStatement, false);
} else {
outputFormatter.Indent();
nodeTracker.TrackedVisit(foreachStatement.EmbeddedStatement, data);
outputFormatter.NewLine();
}
--outputFormatter.IndentationLevel;
PrintIndentedBlock(foreachStatement.EmbeddedStatement);
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.Next);
if (!foreachStatement.NextExpression.IsNull) {
@ -1504,16 +1495,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1504,16 +1495,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
nodeTracker.TrackedVisit(lockStatement.LockExpression, data);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
nodeTracker.TrackedVisit(lockStatement.EmbeddedStatement, data);
--outputFormatter.IndentationLevel;
outputFormatter.NewLine();
PrintIndentedBlock(lockStatement.EmbeddedStatement);
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.SyncLock);
outputFormatter.NewLine();
return null;
}
@ -1529,16 +1516,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1529,16 +1516,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
isUsingResourceAcquisition = false;
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
nodeTracker.TrackedVisit(usingStatement.EmbeddedStatement, data);
--outputFormatter.IndentationLevel;
outputFormatter.NewLine();
PrintIndentedBlock(usingStatement.EmbeddedStatement);
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Using);
outputFormatter.NewLine();
return null;
}
@ -1550,12 +1533,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1550,12 +1533,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
nodeTracker.TrackedVisit(withStatement.Expression, data);
outputFormatter.NewLine();
nodeTracker.TrackedVisit(withStatement.Body, data);
outputFormatter.NewLine();
PrintIndentedBlock(withStatement.Body);
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.With);
outputFormatter.NewLine();
return null;
}
@ -1565,9 +1547,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1565,9 +1547,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Try);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
nodeTracker.TrackedVisit(tryCatchStatement.StatementBlock, data);
--outputFormatter.IndentationLevel;
PrintIndentedBlock(tryCatchStatement.StatementBlock);
foreach (CatchClause catchClause in tryCatchStatement.CatchClauses) {
nodeTracker.TrackedVisit(catchClause, data);
@ -1577,15 +1557,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1577,15 +1557,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.Finally);
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
nodeTracker.TrackedVisit(tryCatchStatement.FinallyBlock, data);
--outputFormatter.IndentationLevel;
PrintIndentedBlock(tryCatchStatement.FinallyBlock);
}
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Try);
outputFormatter.NewLine();
exitTokenStack.Pop();
return null;
}
@ -1615,10 +1592,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1615,10 +1592,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
nodeTracker.TrackedVisit(catchClause.Condition, data);
}
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
nodeTracker.TrackedVisit(catchClause.StatementBlock, data);
--outputFormatter.IndentationLevel;
PrintIndentedBlock(catchClause.StatementBlock);
return null;
}
@ -1703,10 +1678,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1703,10 +1678,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Space();
outputFormatter.PrintIdentifier(forNextStatement.VariableName);
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.As);
outputFormatter.Space();
nodeTracker.TrackedVisit(forNextStatement.TypeReference, data);
if (!forNextStatement.TypeReference.IsNull) {
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.As);
outputFormatter.Space();
nodeTracker.TrackedVisit(forNextStatement.TypeReference, data);
}
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Assign);
@ -1728,16 +1706,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1728,16 +1706,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.NewLine();
++outputFormatter.IndentationLevel;
if (forNextStatement.EmbeddedStatement is BlockStatement) {
nodeTracker.TrackedVisit(forNextStatement.EmbeddedStatement, false);
} else {
outputFormatter.Indent();
nodeTracker.TrackedVisit(forNextStatement.EmbeddedStatement, data);
}
--outputFormatter.IndentationLevel;
outputFormatter.NewLine();
PrintIndentedBlock(forNextStatement.EmbeddedStatement);
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.Next);

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

File diff suppressed because it is too large Load Diff

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

@ -1575,12 +1575,26 @@ ArrayInitializationModifier<out List<Expression> arrayModifiers> @@ -1575,12 +1575,26 @@ ArrayInitializationModifier<out List<Expression> arrayModifiers>
/* 7.5.4.3 */
InitializationRankList<out List<Expression> rank>
(.
rank = null;
rank = new List<Expression>();
Expression expr = null;
.) =
Expr<out expr> (. rank = new List<Expression>(); if (expr != null) { rank.Add(expr); } .)
{
"," Expr<out expr> (. if (expr != null) { rank.Add(expr); } .)
Expr<out expr>
[ "To"
(. if (!(expr is PrimitiveExpression) || (expr as PrimitiveExpression).StringValue != "0")
Error("lower bound of array must be zero");
.)
Expr<out expr>
]
(. if (expr != null) { rank.Add(expr); } .)
{ ","
Expr<out expr>
[ "To"
(. if (!(expr is PrimitiveExpression) || (expr as PrimitiveExpression).StringValue != "0")
Error("lower bound of array must be zero");
.)
Expr<out expr>
]
(. if (expr != null) { rank.Add(expr); } .)
}
.

2
src/Libraries/NRefactory/Project/Src/Parser/Visitors/CSharpToVBNetConvertVisitor.cs

@ -179,7 +179,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -179,7 +179,7 @@ namespace ICSharpCode.NRefactory.Parser
step = -step;
BinaryOperatorExpression condition = forStatement.Condition as BinaryOperatorExpression;
if (!(condition.Left is IdentifierExpression))
if (condition == null || !(condition.Left is IdentifierExpression))
return;
if ((condition.Left as IdentifierExpression).Identifier != iteratorIdentifier.Identifier)
return;

1
src/Libraries/NRefactory/Test/NRefactoryTests.csproj

@ -136,6 +136,7 @@ @@ -136,6 +136,7 @@
<Compile Include="Lexer\CSharp\CustomLexerTests.cs" />
<Compile Include="Parser\Expressions\DefaultValueExpressionTests.cs" />
<Compile Include="Output\VBNet\VBNetOutputTest.cs" />
<Compile Include="Output\VBNet\ConverterTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Project\NRefactory.csproj">

89
src/Libraries/NRefactory/Test/Output/VBNet/ConverterTest.cs

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Text;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.Parser;
using ICSharpCode.NRefactory.Parser.AST;
using ICSharpCode.NRefactory.PrettyPrinter;
namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{
[TestFixture]
public class CSharpToVBConverterTest
{
public void TestProgram(string input, string expectedOutput)
{
IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(input));
parser.Parse();
Assert.AreEqual("", parser.Errors.ErrorOutput);
parser.CompilationUnit.AcceptVisitor(new CSharpToVBNetConvertVisitor(), null);
VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
outputVisitor.Visit(parser.CompilationUnit, null);
Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
Assert.AreEqual(expectedOutput, outputVisitor.Text);
}
public void TestStatement(string input, string expectedOutput)
{
StringBuilder b = new StringBuilder();
b.AppendLine("Class tmp1");
b.AppendLine("\tSub tmp2()");
using (StringReader r = new StringReader(expectedOutput)) {
string line;
while ((line = r.ReadLine()) != null) {
b.Append("\t\t");
b.AppendLine(line);
}
}
b.AppendLine("\tEnd Sub");
b.AppendLine("End Class");
TestProgram("class tmp1 { void tmp2() {\n" + input + "\n}}", b.ToString());
}
[Test]
public void ForWithUnknownConditionAndSingleStatement()
{
TestStatement("for (i = 0; unknownCondition; i++) b[i] = s[i];",
"i = 0\n" +
"While unknownCondition\n" +
"\tb(i) = s(i)\n" +
"\ti += 1\n" +
"End While");
}
[Test]
public void ForWithUnknownConditionAndBlock()
{
TestStatement("for (i = 0; unknownCondition; i++) { b[i] = s[i]; }",
"i = 0\n" +
"While unknownCondition\n" +
"\tb(i) = s(i)\n" +
"\ti += 1\n" +
"End While");
}
[Test]
public void ForWithSingleStatement()
{
TestStatement("for (i = 0; i < end; i++) b[i] = s[i];",
"For i = 0 To [end] - 1\n" +
"\tb(i) = s(i)\n" +
"Next");
}
[Test]
public void ForWithBlock()
{
TestStatement("for (i = 0; i < end; i++) { b[i] = s[i]; }",
"For i = 0 To [end] - 1\n" +
"\tb(i) = s(i)\n" +
"Next");
}
}
}

6
src/Libraries/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs

@ -225,5 +225,11 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -225,5 +225,11 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"Function InterfaceMethod2() As String\n" +
"End Interface");
}
[Test]
public void OnErrorStatement()
{
TestStatement("On Error Resume Next");
}
}
}

16
src/Libraries/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs

@ -236,6 +236,22 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -236,6 +236,22 @@ namespace ICSharpCode.NRefactory.Tests.AST
Assert.AreEqual(11, ((PrimitiveExpression)ace.Arguments[0]).Value);
}
[Test]
public void VBNetLocalArrayDeclarationWithInitializationAndLowerBoundTest()
{
// VB.NET allows only "0" as lower bound
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a(0 To 10) As Integer");
Assert.AreEqual(1, lvd.Variables.Count);
Assert.AreEqual("a", lvd.Variables[0].Name);
TypeReference type = lvd.GetTypeForVariable(0);
Assert.AreEqual("Integer", type.Type);
Assert.AreEqual(new int[] { 0 } , type.RankSpecifier);
ArrayCreateExpression ace = (ArrayCreateExpression)lvd.Variables[0].Initializer;
Assert.AreEqual(new int[] { 0 } , ace.CreateType.RankSpecifier);
Assert.AreEqual(1, ace.Arguments.Count);
Assert.AreEqual(11, ((PrimitiveExpression)ace.Arguments[0]).Value);
}
[Test]
public void VBNetLocalArrayDeclarationTest()
{

Loading…
Cancel
Save