removed some C#-specific Dom classes

This commit is contained in:
Siegfried Pammer 2010-11-07 13:42:30 +01:00
Родитель 8a419bac43
Коммит 789ec0d31c
69 изменённых файлов: 8599 добавлений и 6068 удалений

Просмотреть файл

@ -12,11 +12,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VB", "VB", "{61F5C042-086B-
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.VB.Tests", "VB\Test\ICSharpCode.NRefactory.VB.Tests.csproj", "{870115DD-960A-4406-A6B9-600BCDC36A03}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryASTGenerator", "VB\NRefactoryASTGenerator\NRefactoryASTGenerator.csproj", "{B22522AA-B5BF-4A58-AC6D-D4B45805521F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.VB", "VB\Project\ICSharpCode.NRefactory.VB.csproj", "{7B82B671-419F-45F4-B778-D9286F996EFA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryASTGenerator", "VB\NRefactoryASTGenerator\NRefactoryASTGenerator.csproj", "{B22522AA-B5BF-4A58-AC6D-D4B45805521F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.VB.Tests", "VB\Test\ICSharpCode.NRefactory.VB.Tests.csproj", "{870115DD-960A-4406-A6B9-600BCDC36A03}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory", "ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj", "{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}"
EndProject
@ -64,8 +64,8 @@ Global
{870115DD-960A-4406-A6B9-600BCDC36A03}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B22522AA-B5BF-4A58-AC6D-D4B45805521F} = {61F5C042-086B-45DD-999E-01B1A78A4619}
{7B82B671-419F-45F4-B778-D9286F996EFA} = {61F5C042-086B-45DD-999E-01B1A78A4619}
{870115DD-960A-4406-A6B9-600BCDC36A03} = {61F5C042-086B-45DD-999E-01B1A78A4619}
{7B82B671-419F-45F4-B778-D9286F996EFA} = {61F5C042-086B-45DD-999E-01B1A78A4619}
{B22522AA-B5BF-4A58-AC6D-D4B45805521F} = {61F5C042-086B-45DD-999E-01B1A78A4619}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -163,12 +163,6 @@ namespace NRefactoryASTGenerator.Ast
public UnaryOperatorExpression(Expression expression, UnaryOperatorType op) {}
}
class AnonymousMethodExpression : Expression {
List<ParameterDeclarationExpression> parameters;
BlockStatement body;
bool hasParameterList;
}
[IncludeMember("public Location ExtendedEndLocation { get; set; }")]
class LambdaExpression : Expression {
List<ParameterDeclarationExpression> parameters;

Просмотреть файл

@ -101,7 +101,7 @@ namespace NRefactoryASTGenerator
writer.WriteLine("using ICSharpCode.NRefactory.VB.Parser;");
writer.WriteLine("using ICSharpCode.NRefactory.VB.PrettyPrinter;");
writer.WriteLine();
writer.WriteLine("namespace ICSharpCode.NRefactory.Tests.VB.Lexer");
writer.WriteLine("namespace ICSharpCode.NRefactory.VB.Tests.Lexer");
writer.WriteLine("{");
writer.WriteLine("\t[TestFixture]");
writer.WriteLine("\tpublic sealed class LexerTests");

Просмотреть файл

@ -91,6 +91,9 @@
<Compile Include="Parser\ModifierList.cs" />
<Compile Include="Parser\ParamModifierList.cs" />
<Compile Include="Parser\Parser.cs" />
<None Include="Parser\trace.txt">
<DependentUpon>vb.atg</DependentUpon>
</None>
<Compile Include="Parser\VBNetParser.cs" />
<Compile Include="PrettyPrinter\AbstractOutputFormatter.cs" />
<Compile Include="PrettyPrinter\AbstractPrettyPrintOptions.cs" />
@ -145,6 +148,11 @@
<None Include="Parser\Frames\SharpCoco.exe" />
<None Include="Parser\Frames\trace.txt" />
<None Include="Parser\gen.bat" />
<None Include="Parser\Parser.frame" />
<None Include="Parser\vb.atg">
<CustomToolNamespace>ICSharpCode.NRefactory.VB.Parser</CustomToolNamespace>
<Generator>CocoParserGenerator</Generator>
</None>
<None Include="Parser\vbnet.atg" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />

Просмотреть файл

@ -56,6 +56,11 @@ namespace ICSharpCode.NRefactory.VB.Parser
}
}
public Token()
: this(0, 1, 1)
{
}
public Token(int kind, int col, int line) : this (kind, col, line, null)
{
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -5,7 +5,7 @@ echo Generating with #Coco
cd Frames
copy ..\vbnet.atg
SharpCoco -namespace ICSharpCode.NRefactory.VB.Parser vbnet.atg
SharpCoco -namespace ICSharpCode.NRefactory.VB.Parser -trace FG vbnet.atg
move Parser.cs ..
del vbnet.atg

5305
VB/Project/Parser/trace.txt Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -117,7 +117,7 @@
<Compile Include="Parser\Statements\UsingStatementTests.cs" />
<Compile Include="Parser\Expressions\ClassReferenceExpressionTests.cs" />
<Compile Include="Parser\Expressions\TypeOfIsExpressionTests.cs" />
<Compile Include="Parser\ParseUtilVBNet.cs" />
<Compile Include="Parser\ParseUtil.cs" />
<Compile Include="Parser\GlobalScope\OptionDeclarationTests.cs" />
<Compile Include="Parser\TypeLevel\DeclareDeclarationTests.cs" />
<Compile Include="Parser\Statements\AddHandlerStatementTests.cs" />
@ -134,7 +134,6 @@
<Compile Include="Parser\Statements\WithStatementTests.cs" />
<Compile Include="Output\CodeDOM\CodeDOMPrimitiveExpressionTest.cs" />
<Compile Include="Output\CodeDOM\CodeDOMParenthesizedExpressionTest.cs" />
<Compile Include="Parser\Expressions\AnonymousMethodTests.cs" />
<Compile Include="Output\CodeDOM\InvocationExpressionTest.cs" />
<Compile Include="Parser\Expressions\TypeReferenceExpressionTests.cs" />
<Compile Include="Parser\Expressions\GlobalReferenceExpressionTests.cs" />

Просмотреть файл

@ -6,7 +6,7 @@ using ICSharpCode.NRefactory.VB;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.PrettyPrinter;
namespace ICSharpCode.NRefactory.Tests.VB.Lexer
namespace ICSharpCode.NRefactory.VB.Tests.Lexer
{
[TestFixture]
public sealed class LexerTests

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void SimpleAddressOfExpressionTest()
{
AddressOfExpression ae = ParseUtilVBNet.ParseExpression<AddressOfExpression>("AddressOf t");
AddressOfExpression ae = ParseUtil.ParseExpression<AddressOfExpression>("AddressOf t");
Assert.IsNotNull(ae);
Assert.IsInstanceOf(typeof(IdentifierExpression), ae.Expression);
Assert.AreEqual("t", ((IdentifierExpression)ae.Expression).Identifier, "t");
@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void GenericAddressOfExpressionTest()
{
AddressOfExpression ae = ParseUtilVBNet.ParseExpression<AddressOfExpression>("AddressOf t(Of X)");
AddressOfExpression ae = ParseUtil.ParseExpression<AddressOfExpression>("AddressOf t(Of X)");
Assert.IsNotNull(ae);
Assert.IsInstanceOf(typeof(IdentifierExpression), ae.Expression);
Assert.AreEqual("t", ((IdentifierExpression)ae.Expression).Identifier, "t");
@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void MemberReferenceAddressOfExpressionTest()
{
AddressOfExpression ae = ParseUtilVBNet.ParseExpression<AddressOfExpression>("AddressOf Me.t(Of X)");
AddressOfExpression ae = ParseUtil.ParseExpression<AddressOfExpression>("AddressOf Me.t(Of X)");
Assert.IsNotNull(ae);
Assert.IsInstanceOf(typeof(MemberReferenceExpression), ae.Expression);
Assert.AreEqual("t", ((MemberReferenceExpression)ae.Expression).MemberName, "t");

Просмотреть файл

@ -1,59 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
[TestFixture]
public class AnonymousMethodTests
{
// AnonymousMethodExpression Parse(string program)
// {
// return ParseUtilCSharp.ParseExpression<AnonymousMethodExpression>(program);
// }
//
// [Test]
// public void AnonymousMethodWithoutParameterList()
// {
// AnonymousMethodExpression ame = Parse("delegate {}");
// Assert.AreEqual(0, ame.Parameters.Count);
// Assert.AreEqual(0, ame.Body.Children.Count);
// Assert.IsFalse(ame.HasParameterList);
// }
//
// [Test]
// public void AnonymousMethodAfterCast()
// {
// CastExpression c = ParseUtilCSharp.ParseExpression<CastExpression>("(ThreadStart)delegate {}");
// Assert.AreEqual("ThreadStart", c.CastTo.Type);
// AnonymousMethodExpression ame = (AnonymousMethodExpression)c.Expression;
// Assert.AreEqual(0, ame.Parameters.Count);
// Assert.AreEqual(0, ame.Body.Children.Count);
// }
//
// [Test]
// public void EmptyAnonymousMethod()
// {
// AnonymousMethodExpression ame = Parse("delegate() {}");
// Assert.AreEqual(0, ame.Parameters.Count);
// Assert.AreEqual(0, ame.Body.Children.Count);
// Assert.IsTrue(ame.HasParameterList);
// }
//
// [Test]
// public void SimpleAnonymousMethod()
// {
// AnonymousMethodExpression ame = Parse("delegate(int a, int b) { return a + b; }");
// Assert.AreEqual(2, ame.Parameters.Count);
// // blocks can't be added without compilation unit -> anonymous method body
// // is always empty when using ParseExpression
// //Assert.AreEqual(1, ame.Body.Children.Count);
// //Assert.IsTrue(ame.Body.Children[0] is ReturnStatement);
// }
}
}

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void ArrayCreateExpressionTest1()
{
ArrayCreateExpression ace = ParseUtilVBNet.ParseExpression<ArrayCreateExpression>("new Integer() {1, 2, 3, 4}");
ArrayCreateExpression ace = ParseUtil.ParseExpression<ArrayCreateExpression>("new Integer() {1, 2, 3, 4}");
Assert.AreEqual("System.Int32", ace.CreateType.Type);
Assert.AreEqual(0, ace.Arguments.Count);
@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void ArrayCreateExpressionTest2()
{
ArrayCreateExpression ace = ParseUtilVBNet.ParseExpression<ArrayCreateExpression>("New Integer(0 To 5){0, 1, 2, 3, 4, 5}");
ArrayCreateExpression ace = ParseUtil.ParseExpression<ArrayCreateExpression>("New Integer(0 To 5){0, 1, 2, 3, 4, 5}");
Assert.AreEqual("System.Int32", ace.CreateType.Type);
Assert.AreEqual(1, ace.Arguments.Count);

Просмотреть файл

@ -14,7 +14,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
void TestAssignmentExpression(string program, AssignmentOperatorType op)
{
ExpressionStatement se = ParseUtilVBNet.ParseStatement<ExpressionStatement>(program);
ExpressionStatement se = ParseUtil.ParseStatement<ExpressionStatement>(program);
AssignmentExpression ae = se.Expression as AssignmentExpression;
Assert.AreEqual(op, ae.Op);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetBaseReferenceExpressionTest1()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("MyBase.myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("MyBase.myField");
Assert.IsTrue(fre.TargetObject is BaseReferenceExpression);
}
#endregion

Просмотреть файл

@ -18,7 +18,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "a " + weakOperator + " b " + strongOperator + " c";
BinaryOperatorExpression boe;
boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
boe = ParseUtil.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(weakOperatorType, boe.Op);
Assert.IsTrue(boe.Left is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Right;
@ -27,7 +27,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
Assert.IsTrue(boe.Right is IdentifierExpression);
program = "a " + strongOperator + " b " + weakOperator + " c";
boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
boe = ParseUtil.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(weakOperatorType, boe.Op);
Assert.IsTrue(boe.Right is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Left;
@ -41,7 +41,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "a " + secondOperator + " b " + firstOperator + " c";
BinaryOperatorExpression boe;
boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
boe = ParseUtil.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(firstOperatorType, boe.Op);
Assert.IsTrue(boe.Right is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Left;
@ -50,7 +50,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
Assert.IsTrue(boe.Right is IdentifierExpression);
program = "a " + firstOperator + " b " + secondOperator + " c";
boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
boe = ParseUtil.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(secondOperatorType, boe.Op);
Assert.IsTrue(boe.Right is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Left;
@ -62,7 +62,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
#region VB.NET
void VBNetTestBinaryOperatorExpressionTest(string program, BinaryOperatorType op)
{
BinaryOperatorExpression boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
BinaryOperatorExpression boe = ParseUtil.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(op, boe.Op);
Assert.IsTrue(boe.Left is IdentifierExpression);
@ -249,7 +249,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetDictionaryAccess()
{
BinaryOperatorExpression boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>("a!b");
BinaryOperatorExpression boe = ParseUtil.ParseExpression<BinaryOperatorExpression>("a!b");
Assert.AreEqual(BinaryOperatorType.DictionaryAccess, boe.Op);
Assert.IsTrue(boe.Left is IdentifierExpression);
Assert.IsTrue(boe.Right is PrimitiveExpression);
@ -258,7 +258,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetWithDictionaryAccess()
{
BinaryOperatorExpression boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>("!b");
BinaryOperatorExpression boe = ParseUtil.ParseExpression<BinaryOperatorExpression>("!b");
Assert.AreEqual(BinaryOperatorType.DictionaryAccess, boe.Op);
Assert.IsTrue(boe.Left.IsNull);
Assert.IsTrue(boe.Right is PrimitiveExpression);
@ -273,7 +273,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
string AddInteger<T>(string input, int number) where T : Expression
{
Expression e = ParseUtilVBNet.ParseExpression<T>(input);
Expression e = ParseUtil.ParseExpression<T>(input);
e = Expression.AddInteger(e, number);
VBNetOutputVisitor v = new VBNetOutputVisitor();
e.AcceptVisitor(v, null);

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
#region VB.NET
void TestSpecializedCast(string castExpression, Type castType)
{
CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>(castExpression);
CastExpression ce = ParseUtil.ParseExpression<CastExpression>(castExpression);
Assert.AreEqual(castType.FullName, ce.CastTo.Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);
Assert.AreEqual(CastType.PrimitiveConversion, ce.CastType);
@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleCastExpression()
{
CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("CType(o, MyObject)");
CastExpression ce = ParseUtil.ParseExpression<CastExpression>("CType(o, MyObject)");
Assert.AreEqual("MyObject", ce.CastTo.Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);
Assert.AreEqual(CastType.Conversion, ce.CastType);
@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericCastExpression()
{
CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("CType(o, List(of T))");
CastExpression ce = ParseUtil.ParseExpression<CastExpression>("CType(o, List(of T))");
Assert.AreEqual("List", ce.CastTo.Type);
Assert.AreEqual("T", ce.CastTo.GenericTypes[0].Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);
@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleDirectCastExpression()
{
CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("DirectCast(o, MyObject)");
CastExpression ce = ParseUtil.ParseExpression<CastExpression>("DirectCast(o, MyObject)");
Assert.AreEqual("MyObject", ce.CastTo.Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);
Assert.AreEqual(CastType.Cast, ce.CastType);
@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericDirectCastExpression()
{
CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("DirectCast(o, List(of T))");
CastExpression ce = ParseUtil.ParseExpression<CastExpression>("DirectCast(o, List(of T))");
Assert.AreEqual("List", ce.CastTo.Type);
Assert.AreEqual("T", ce.CastTo.GenericTypes[0].Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);
@ -63,7 +63,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleTryCastExpression()
{
CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("TryCast(o, MyObject)");
CastExpression ce = ParseUtil.ParseExpression<CastExpression>("TryCast(o, MyObject)");
Assert.AreEqual("MyObject", ce.CastTo.Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);
Assert.AreEqual(CastType.TryCast, ce.CastType);
@ -72,7 +72,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericTryCastExpression()
{
CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("TryCast(o, List(of T))");
CastExpression ce = ParseUtil.ParseExpression<CastExpression>("TryCast(o, List(of T))");
Assert.AreEqual("List", ce.CastTo.Type);
Assert.AreEqual("T", ce.CastTo.GenericTypes[0].Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetClassReferenceExpressionTest1()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("MyClass.myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("MyClass.myField");
Assert.IsTrue(fre.TargetObject is ClassReferenceExpression);
}
#endregion

Просмотреть файл

@ -17,7 +17,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetConditionalExpressionTest()
{
ConditionalExpression ce = ParseUtilVBNet.ParseExpression<ConditionalExpression>("If(x IsNot Nothing, x.Test, \"nothing\")");
ConditionalExpression ce = ParseUtil.ParseExpression<ConditionalExpression>("If(x IsNot Nothing, x.Test, \"nothing\")");
Assert.IsTrue(ce.Condition is BinaryOperatorExpression);
Assert.IsTrue(ce.TrueExpression is MemberReferenceExpression);

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGlobalReferenceExpressionTest()
{
TypeReferenceExpression tre = ParseUtilVBNet.ParseExpression<TypeReferenceExpression>("Global.System");
TypeReferenceExpression tre = ParseUtil.ParseExpression<TypeReferenceExpression>("Global.System");
Assert.IsTrue(tre.TypeReference.IsGlobal);
Assert.AreEqual("System", tre.TypeReference.Type);
}
@ -23,7 +23,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGlobalTypeDeclaration()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As Global.System.String");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a As Global.System.String");
TypeReference typeRef = lvd.GetTypeForVariable(0);
Assert.IsTrue(typeRef.IsGlobal);
Assert.AreEqual("System.String", typeRef.Type);

Просмотреть файл

@ -16,24 +16,24 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetIdentifierExpressionTest1()
{
IdentifierExpression ie = ParseUtilVBNet.ParseExpression<IdentifierExpression>("MyIdentifier");
IdentifierExpression ie = ParseUtil.ParseExpression<IdentifierExpression>("MyIdentifier");
Assert.AreEqual("MyIdentifier", ie.Identifier);
}
[Test]
public void VBNetIdentifierExpressionTest2()
{
IdentifierExpression ie = ParseUtilVBNet.ParseExpression<IdentifierExpression>("[Public]");
IdentifierExpression ie = ParseUtil.ParseExpression<IdentifierExpression>("[Public]");
Assert.AreEqual("Public", ie.Identifier);
}
[Test]
public void VBNetContextKeywordsTest()
{
Assert.AreEqual("Assembly", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Assembly").Identifier);
Assert.AreEqual("Custom", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Custom").Identifier);
Assert.AreEqual("Off", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Off").Identifier);
Assert.AreEqual("Explicit", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Explicit").Identifier);
Assert.AreEqual("Assembly", ParseUtil.ParseExpression<IdentifierExpression>("Assembly").Identifier);
Assert.AreEqual("Custom", ParseUtil.ParseExpression<IdentifierExpression>("Custom").Identifier);
Assert.AreEqual("Off", ParseUtil.ParseExpression<IdentifierExpression>("Off").Identifier);
Assert.AreEqual("Explicit", ParseUtil.ParseExpression<IdentifierExpression>("Explicit").Identifier);
}
#endregion
}

Просмотреть файл

@ -46,32 +46,32 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleInvocationExpressionTest()
{
CheckSimpleInvoke(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod()"));
CheckSimpleInvoke(ParseUtil.ParseExpression<InvocationExpression>("myMethod()"));
}
[Test]
public void VBNetGenericInvocationExpressionTest()
{
CheckGenericInvoke(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod(Of Char)(\"a\"c)"));
CheckGenericInvoke(ParseUtil.ParseExpression<InvocationExpression>("myMethod(Of Char)(\"a\"c)"));
}
[Test]
public void VBNetGenericInvocation2ExpressionTest()
{
CheckGenericInvoke2(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod(Of T, Boolean)()"));
CheckGenericInvoke2(ParseUtil.ParseExpression<InvocationExpression>("myMethod(Of T, Boolean)()"));
}
[Test]
public void PrimitiveExpression1Test()
{
InvocationExpression ie = ParseUtilVBNet.ParseExpression<InvocationExpression>("546.ToString()");
InvocationExpression ie = ParseUtil.ParseExpression<InvocationExpression>("546.ToString()");
Assert.AreEqual(0, ie.Arguments.Count);
}
[Test]
public void VBInvocationOnGenericType()
{
InvocationExpression expr = ParseUtilVBNet.ParseExpression<InvocationExpression>("A(Of T).Foo()");
InvocationExpression expr = ParseUtil.ParseExpression<InvocationExpression>("A(Of T).Foo()");
MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
Assert.AreEqual("Foo", mre.MemberName);
IdentifierExpression tre = (IdentifierExpression)mre.TargetObject;
@ -82,7 +82,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBInvocationOnInnerClassInGenericType()
{
InvocationExpression expr = ParseUtilVBNet.ParseExpression<InvocationExpression>("A(Of T).B.Foo()");
InvocationExpression expr = ParseUtil.ParseExpression<InvocationExpression>("A(Of T).B.Foo()");
MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
Assert.AreEqual("Foo", mre.MemberName);
MemberReferenceExpression mre2 = (MemberReferenceExpression)mre.TargetObject;
@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBInvocationOnGenericInnerClassInGenericType()
{
InvocationExpression expr = ParseUtilVBNet.ParseExpression<InvocationExpression>("A(Of T).B.C(Of U).Foo()");
InvocationExpression expr = ParseUtil.ParseExpression<InvocationExpression>("A(Of T).B.C(Of U).Foo()");
MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
Assert.AreEqual("Foo", mre.MemberName);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
static LambdaExpression ParseVBNet(string program)
{
return ParseUtilVBNet.ParseExpression<LambdaExpression>(program);
return ParseUtil.ParseExpression<LambdaExpression>(program);
}
[Test]

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleFieldReferenceExpressionTest()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("myTargetObject.myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("myTargetObject.myField");
Assert.AreEqual("myField", fre.MemberName);
Assert.IsTrue(fre.TargetObject is IdentifierExpression);
Assert.AreEqual("myTargetObject", ((IdentifierExpression)fre.TargetObject).Identifier);
@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetFieldReferenceExpressionWithoutTargetTest()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>(".myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>(".myField");
Assert.AreEqual("myField", fre.MemberName);
Assert.IsTrue(fre.TargetObject.IsNull);
}
@ -33,7 +33,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericFieldReferenceExpressionTest()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("SomeClass(of string).myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("SomeClass(of string).myField");
Assert.AreEqual("myField", fre.MemberName);
Assert.IsInstanceOf(typeof(IdentifierExpression), fre.TargetObject);
TypeReference tr = ((IdentifierExpression)fre.TargetObject).TypeArguments[0];
@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetFullNamespaceGenericFieldReferenceExpressionTest()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("System.Subnamespace.SomeClass(of string).myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("System.Subnamespace.SomeClass(of string).myField");
Assert.AreEqual("myField", fre.MemberName);
Assert.IsInstanceOf(typeof(MemberReferenceExpression), fre.TargetObject);
@ -56,7 +56,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGlobalFullNamespaceGenericFieldReferenceExpressionTest()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("Global.System.Subnamespace.SomeClass(of string).myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("Global.System.Subnamespace.SomeClass(of string).myField");
Assert.AreEqual("myField", fre.MemberName);
Assert.IsInstanceOf(typeof(MemberReferenceExpression), fre.TargetObject);
MemberReferenceExpression inner = (MemberReferenceExpression)fre.TargetObject;
@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetNestedGenericFieldReferenceExpressionTest()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("MyType(of string).InnerClass(of integer).myField");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("MyType(of string).InnerClass(of integer).myField");
Assert.AreEqual("myField", fre.MemberName);
Assert.IsInstanceOf(typeof(MemberReferenceExpression), fre.TargetObject);

Просмотреть файл

@ -33,7 +33,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetAnonymousType()
{
ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>(
ObjectCreateExpression oce = ParseUtil.ParseExpression<ObjectCreateExpression>(
"New With {.Id = 1, .Name= \"Bill Gates\" }");
Assert.IsTrue(oce.CreateType.IsNull);
@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetAnonymousTypeWithoutProperty()
{
ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("New With { c }");
ObjectCreateExpression oce = ParseUtil.ParseExpression<ObjectCreateExpression>("New With { c }");
Assert.IsTrue(oce.CreateType.IsNull);
Assert.AreEqual(0, oce.Parameters.Count);
@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleObjectCreateExpressionTest()
{
CheckSimpleObjectCreateExpression(ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("New MyObject(1, 2, 3)"));
CheckSimpleObjectCreateExpression(ParseUtil.ParseExpression<ObjectCreateExpression>("New MyObject(1, 2, 3)"));
}
[Test]
@ -68,7 +68,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
// this test was written because this bug caused the AbstractASTVisitor to crash
InvocationExpression expr = ParseUtilVBNet.ParseExpression<InvocationExpression>("WriteLine(New SomeGenericType(Of Integer, )())", true);
InvocationExpression expr = ParseUtil.ParseExpression<InvocationExpression>("WriteLine(New SomeGenericType(Of Integer, )())", true);
Assert.IsTrue(expr.TargetObject is IdentifierExpression);
Assert.AreEqual("WriteLine", ((IdentifierExpression)expr.TargetObject).Identifier);
Assert.AreEqual(1, expr.Arguments.Count); // here a second null parameter was added incorrectly
@ -83,7 +83,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetMemberInitializationTest()
{
ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("new Contact() With { .FirstName = \"Bill\", .LastName = \"Gates\" }");
ObjectCreateExpression oce = ParseUtil.ParseExpression<ObjectCreateExpression>("new Contact() With { .FirstName = \"Bill\", .LastName = \"Gates\" }");
Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
Assert.AreEqual("FirstName", ((MemberInitializerExpression)oce.ObjectInitializer.CreateExpressions[0]).Name);
@ -96,7 +96,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetNullableObjectCreateExpressionTest()
{
ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("New Integer?");
ObjectCreateExpression oce = ParseUtil.ParseExpression<ObjectCreateExpression>("New Integer?");
Assert.AreEqual("System.Nullable", oce.CreateType.Type);
Assert.AreEqual(1, oce.CreateType.GenericTypes.Count);
Assert.AreEqual("System.Int32", oce.CreateType.GenericTypes[0].Type);
@ -105,7 +105,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetNullableObjectArrayCreateExpressionTest()
{
ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("New Integer?()");
ObjectCreateExpression oce = ParseUtil.ParseExpression<ObjectCreateExpression>("New Integer?()");
Assert.AreEqual("System.Nullable", oce.CreateType.Type);
Assert.AreEqual(1, oce.CreateType.GenericTypes.Count);
Assert.AreEqual("System.Int32", oce.CreateType.GenericTypes[0].Type);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetPrimitiveParenthesizedExpression()
{
ParenthesizedExpression p = ParseUtilVBNet.ParseExpression<ParenthesizedExpression>("((1))");
ParenthesizedExpression p = ParseUtil.ParseExpression<ParenthesizedExpression>("((1))");
Assert.IsTrue(p.Expression is ParenthesizedExpression);
p = p.Expression as ParenthesizedExpression;;
Assert.IsTrue(p.Expression is PrimitiveExpression);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void PrimitiveExpression1Test()
{
InvocationExpression ie = ParseUtilVBNet.ParseExpression<InvocationExpression>("546.ToString()");
InvocationExpression ie = ParseUtil.ParseExpression<InvocationExpression>("546.ToString()");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
void RunTest(string expression, int expectedCount, Action<QueryExpression> constraint, params Type[] expectedTypes)
{
var expr = ParseUtilVBNet.ParseExpression<QueryExpression>(expression);
var expr = ParseUtil.ParseExpression<QueryExpression>(expression);
Assert.AreEqual(expectedCount, expr.Clauses.Count);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetThisReferenceExpressionTest1()
{
ThisReferenceExpression ie = ParseUtilVBNet.ParseExpression<ThisReferenceExpression>("Me");
ThisReferenceExpression ie = ParseUtil.ParseExpression<ThisReferenceExpression>("Me");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBSimpleTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyNamespace.N1.MyType)");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(MyNamespace.N1.MyType)");
Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
}
@ -24,28 +24,28 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBGlobalTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(Global.System.Console)");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(Global.System.Console)");
Assert.AreEqual("System.Console", toe.TypeReference.Type);
}
[Test]
public void VBPrimitiveTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(integer)");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(integer)");
Assert.AreEqual("System.Int32", toe.TypeReference.Type);
}
[Test]
public void VBVoidTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(void)");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(void)");
Assert.AreEqual("void", toe.TypeReference.Type);
}
[Test]
public void VBArrayTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyType())");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(MyType())");
Assert.AreEqual("MyType", toe.TypeReference.Type);
Assert.AreEqual(new int[] {0}, toe.TypeReference.RankSpecifier);
}
@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBGenericTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyNamespace.N1.MyType(Of string))");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(MyNamespace.N1.MyType(Of string))");
Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
Assert.AreEqual("System.String", toe.TypeReference.GenericTypes[0].Type);
}
@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBUnboundTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyType(Of ,))");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(MyType(Of ,))");
Assert.AreEqual("MyType", toe.TypeReference.Type);
Assert.IsTrue(toe.TypeReference.GenericTypes[0].IsNull);
Assert.IsTrue(toe.TypeReference.GenericTypes[1].IsNull);
@ -70,7 +70,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNestedGenericTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyType(Of string).InnerClass(of integer).InnerInnerClass)");
TypeOfExpression toe = ParseUtil.ParseExpression<TypeOfExpression>("GetType(MyType(Of string).InnerClass(of integer).InnerInnerClass)");
InnerClassTypeReference ic = (InnerClassTypeReference)toe.TypeReference;
Assert.AreEqual("InnerInnerClass", ic.Type);
Assert.AreEqual(0, ic.GenericTypes.Count);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleTypeOfIsExpression()
{
TypeOfIsExpression ce = ParseUtilVBNet.ParseExpression<TypeOfIsExpression>("TypeOf o Is MyObject");
TypeOfIsExpression ce = ParseUtil.ParseExpression<TypeOfIsExpression>("TypeOf o Is MyObject");
Assert.AreEqual("MyObject", ce.TypeReference.Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);
}
@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericTypeOfIsExpression()
{
TypeOfIsExpression ce = ParseUtilVBNet.ParseExpression<TypeOfIsExpression>("TypeOf o Is List(of T)");
TypeOfIsExpression ce = ParseUtil.ParseExpression<TypeOfIsExpression>("TypeOf o Is List(of T)");
Assert.AreEqual("List", ce.TypeReference.Type);
Assert.AreEqual("T", ce.TypeReference.GenericTypes[0].Type);
Assert.IsTrue(ce.Expression is IdentifierExpression);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBIntReferenceExpression()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("inTeGer.MaxValue");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("inTeGer.MaxValue");
Assert.AreEqual("MaxValue", fre.MemberName);
Assert.AreEqual("System.Int32", ((TypeReferenceExpression)fre.TargetObject).TypeReference.Type);
}
@ -24,14 +24,14 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBStandaloneIntReferenceExpression()
{
TypeReferenceExpression tre = ParseUtilVBNet.ParseExpression<TypeReferenceExpression>("inTeGer");
TypeReferenceExpression tre = ParseUtil.ParseExpression<TypeReferenceExpression>("inTeGer");
Assert.AreEqual("System.Int32", tre.TypeReference.Type);
}
[Test]
public void VBObjectReferenceExpression()
{
MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("Object.ReferenceEquals");
MemberReferenceExpression fre = ParseUtil.ParseExpression<MemberReferenceExpression>("Object.ReferenceEquals");
Assert.AreEqual("ReferenceEquals", fre.MemberName);
Assert.AreEqual("System.Object", ((TypeReferenceExpression)fre.TargetObject).TypeReference.Type);
}
@ -39,7 +39,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBStandaloneObjectReferenceExpression()
{
TypeReferenceExpression tre = ParseUtilVBNet.ParseExpression<TypeReferenceExpression>("obJect");
TypeReferenceExpression tre = ParseUtil.ParseExpression<TypeReferenceExpression>("obJect");
Assert.AreEqual("System.Object", tre.TypeReference.Type);
}
#endregion

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
#region VB.NET
void VBNetTestUnaryOperatorExpressionTest(string program, UnaryOperatorType op)
{
UnaryOperatorExpression uoe = ParseUtilVBNet.ParseExpression<UnaryOperatorExpression>(program);
UnaryOperatorExpression uoe = ParseUtil.ParseExpression<UnaryOperatorExpression>(program);
Assert.AreEqual(op, uoe.Op);
Assert.IsTrue(uoe.Expression is IdentifierExpression);
@ -30,7 +30,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetInEqualsNotTest()
{
BinaryOperatorExpression e = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>("b <> Not a");
BinaryOperatorExpression e = ParseUtil.ParseExpression<BinaryOperatorExpression>("b <> Not a");
Assert.AreEqual(BinaryOperatorType.InEquality, e.Op);
UnaryOperatorExpression ue = (UnaryOperatorExpression)e.Right;
Assert.AreEqual(UnaryOperatorType.Not, ue.Op);
@ -39,7 +39,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetNotEqualTest()
{
UnaryOperatorExpression e = ParseUtilVBNet.ParseExpression<UnaryOperatorExpression>("Not a = b");
UnaryOperatorExpression e = ParseUtil.ParseExpression<UnaryOperatorExpression>("Not a = b");
Assert.AreEqual(UnaryOperatorType.Not, e.Op);
BinaryOperatorExpression boe = (BinaryOperatorExpression)e.Expression;
Assert.AreEqual(BinaryOperatorType.Equality, boe.Op);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleCommentTest()
{
XmlContentExpression content = ParseUtilVBNet.ParseExpression<XmlContentExpression>("<!-- test -->");
XmlContentExpression content = ParseUtil.ParseExpression<XmlContentExpression>("<!-- test -->");
Assert.AreEqual(XmlContentType.Comment, content.Type);
Assert.AreEqual(" test ", content.Content);
Assert.AreEqual(new Location(1,1), content.StartLocation);
@ -26,7 +26,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimplePreprocessingInstructionTest()
{
XmlContentExpression content = ParseUtilVBNet.ParseExpression<XmlContentExpression>("<?xml version='1.0'?>");
XmlContentExpression content = ParseUtil.ParseExpression<XmlContentExpression>("<?xml version='1.0'?>");
Assert.AreEqual(XmlContentType.ProcessingInstruction, content.Type);
Assert.AreEqual("xml version='1.0'", content.Content);
Assert.AreEqual(new Location(1,1), content.StartLocation);
@ -36,7 +36,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleCDataTest()
{
XmlContentExpression content = ParseUtilVBNet.ParseExpression<XmlContentExpression>("<![CDATA[<simple> <cdata>]]>");
XmlContentExpression content = ParseUtil.ParseExpression<XmlContentExpression>("<![CDATA[<simple> <cdata>]]>");
Assert.AreEqual(XmlContentType.CData, content.Type);
Assert.AreEqual("<simple> <cdata>", content.Content);
Assert.AreEqual(new Location(1,1), content.StartLocation);
@ -46,7 +46,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleEmptyElementTest()
{
XmlElementExpression element = ParseUtilVBNet.ParseExpression<XmlElementExpression>("<Test />");
XmlElementExpression element = ParseUtil.ParseExpression<XmlElementExpression>("<Test />");
Assert.IsFalse(element.NameIsExpression);
Assert.AreEqual("Test", element.XmlName);
Assert.IsEmpty(element.Attributes);
@ -58,7 +58,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleEmptyElementWithAttributeTest()
{
XmlElementExpression element = ParseUtilVBNet.ParseExpression<XmlElementExpression>("<Test id='0' />");
XmlElementExpression element = ParseUtil.ParseExpression<XmlElementExpression>("<Test id='0' />");
Assert.IsFalse(element.NameIsExpression);
Assert.AreEqual("Test", element.XmlName);
Assert.IsNotEmpty(element.Attributes);
@ -79,7 +79,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleEmptyElementWithAttributesTest()
{
XmlElementExpression element = ParseUtilVBNet.ParseExpression<XmlElementExpression>("<Test id='0' name=<%= name %> <%= contentData %> />"); Assert.IsFalse(element.NameIsExpression);
XmlElementExpression element = ParseUtil.ParseExpression<XmlElementExpression>("<Test id='0' name=<%= name %> <%= contentData %> />"); Assert.IsFalse(element.NameIsExpression);
Assert.AreEqual("Test", element.XmlName);
Assert.IsNotEmpty(element.Attributes);
Assert.AreEqual(3, element.Attributes.Count);
@ -129,7 +129,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetElementWithAttributeTest()
{
XmlElementExpression element = ParseUtilVBNet.ParseExpression<XmlElementExpression>("<Test id='0'>\n" +
XmlElementExpression element = ParseUtil.ParseExpression<XmlElementExpression>("<Test id='0'>\n" +
" <Item />\n" +
" <Item />\n" +
"</Test>");
@ -164,7 +164,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetElementWithMixedContentTest()
{
XmlElementExpression element = ParseUtilVBNet.ParseExpression<XmlElementExpression>("<Test id='0'>\n" +
XmlElementExpression element = ParseUtil.ParseExpression<XmlElementExpression>("<Test id='0'>\n" +
" <!-- test -->\n" +
" <Item />\n" +
" <Item />\n" +
@ -205,7 +205,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetElementWithMixedContentTest2()
{
XmlElementExpression element = ParseUtilVBNet.ParseExpression<XmlElementExpression>("<Test> aaaa </Test>");
XmlElementExpression element = ParseUtil.ParseExpression<XmlElementExpression>("<Test> aaaa </Test>");
Assert.IsFalse(element.NameIsExpression);
Assert.AreEqual("Test", element.XmlName);
@ -218,7 +218,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetProcessingInstructionAndCommentAtEndTest()
{
XmlDocumentExpression document = ParseUtilVBNet.ParseExpression<XmlDocumentExpression>("<Test />\n" +
XmlDocumentExpression document = ParseUtil.ParseExpression<XmlDocumentExpression>("<Test />\n" +
"<!-- test -->\n" +
"<?target some text?>");
Assert.IsNotEmpty(document.Expressions);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleElementReferenceTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>("xml.<ns:MyElement>");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>("xml.<ns:MyElement>");
Assert.AreEqual("ns:MyElement", xmae.Identifier);
Assert.IsTrue(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Element, xmae.AxisType);
@ -27,7 +27,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleAttributeReferenceTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>("xml.@attribute");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>("xml.@attribute");
Assert.AreEqual("attribute", xmae.Identifier);
Assert.IsFalse(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Attribute, xmae.AxisType);
@ -38,7 +38,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetXmlNameAttributeReferenceTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>("xml.@<ns:attribute>");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>("xml.@<ns:attribute>");
Assert.AreEqual("ns:attribute", xmae.Identifier);
Assert.IsTrue(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Attribute, xmae.AxisType);
@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleDescendentsReferenceTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>("xml...<ns:Element>");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>("xml...<ns:Element>");
Assert.AreEqual("ns:Element", xmae.Identifier);
Assert.IsTrue(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Descendents, xmae.AxisType);
@ -60,7 +60,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleElementReferenceWithDotTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>(".<ns:MyElement>");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>(".<ns:MyElement>");
Assert.AreEqual("ns:MyElement", xmae.Identifier);
Assert.IsTrue(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Element, xmae.AxisType);
@ -70,7 +70,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleAttributeReferenceWithDotTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>(".@attribute");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>(".@attribute");
Assert.AreEqual("attribute", xmae.Identifier);
Assert.IsFalse(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Attribute, xmae.AxisType);
@ -80,7 +80,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetXmlNameAttributeReferenceWithDotTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>(".@<ns:attribute>");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>(".@<ns:attribute>");
Assert.AreEqual("ns:attribute", xmae.Identifier);
Assert.IsTrue(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Attribute, xmae.AxisType);
@ -90,7 +90,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleDescendentsReferenceWithDotTest()
{
XmlMemberAccessExpression xmae = ParseUtilVBNet.ParseExpression<XmlMemberAccessExpression>("...<ns:Element>");
XmlMemberAccessExpression xmae = ParseUtil.ParseExpression<XmlMemberAccessExpression>("...<ns:Element>");
Assert.AreEqual("ns:Element", xmae.Identifier);
Assert.IsTrue(xmae.IsXmlIdentifier);
Assert.AreEqual(XmlAxisType.Descendents, xmae.AxisType);

Просмотреть файл

@ -24,7 +24,7 @@ Public Structure MyUnion
End Structure 'MyUnion
";
TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration decl = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("StructLayout", decl.Attributes[0].Attributes[0].Name);
}
@ -40,7 +40,7 @@ Public Module MyExtra
End Module
";
TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration decl = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("HideModule", decl.Attributes[0].Attributes[0].Name);
}
@ -51,7 +51,7 @@ End Module
Public Class Form1
End Class";
TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration decl = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("Microsoft.VisualBasic.CompilerServices.DesignerGenerated", decl.Attributes[0].Attributes[0].Name);
}
@ -59,7 +59,7 @@ End Class";
public void AssemblyAttribute()
{
string program = @"<assembly: System.Attribute()>";
AttributeSection decl = ParseUtilVBNet.ParseGlobal<AttributeSection>(program);
AttributeSection decl = ParseUtil.ParseGlobal<AttributeSection>(program);
Assert.AreEqual(new Location(1, 1), decl.StartLocation);
Assert.AreEqual("assembly", decl.AttributeTarget);
}
@ -68,7 +68,7 @@ End Class";
public void ModuleAttributeTargetEscaped()
{
// check that this doesn't crash the parser:
ParseUtilVBNet.ParseGlobal<AttributeSection>("<[Module]: SuppressMessageAttribute>", true);
ParseUtil.ParseGlobal<AttributeSection>("<[Module]: SuppressMessageAttribute>", true);
}
}
}

Просмотреть файл

@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void SimpleVBNetDelegateDeclarationTest()
{
string program = "Public Delegate Sub MyDelegate(ByVal a As Integer, ByVal secondParam As Integer, ByVal lastParam As MyObj)\n";
TestDelegateDeclaration(ParseUtilVBNet.ParseGlobal<DelegateDeclaration>(program));
TestDelegateDeclaration(ParseUtil.ParseGlobal<DelegateDeclaration>(program));
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "Namespace TestNamespace" + Environment.NewLine +
"End Namespace" +Environment.NewLine;
NamespaceDeclaration ns = ParseUtilVBNet.ParseGlobal<NamespaceDeclaration>(program);
NamespaceDeclaration ns = ParseUtil.ParseGlobal<NamespaceDeclaration>(program);
Assert.AreEqual("TestNamespace", ns.Name);
}
@ -28,7 +28,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
" End Namespace\n" +
"End Namespace\n";
NamespaceDeclaration ns = ParseUtilVBNet.ParseGlobal<NamespaceDeclaration>(program);
NamespaceDeclaration ns = ParseUtil.ParseGlobal<NamespaceDeclaration>(program);
Assert.AreEqual("N1", ns.Name);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetStrictOptionDeclarationTest()
{
string program = "Option Strict On\n";
OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
OptionDeclaration opDec = ParseUtil.ParseGlobal<OptionDeclaration>(program);
Assert.AreEqual(OptionType.Strict, opDec.OptionType);
Assert.IsTrue(opDec.OptionValue);
}
@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetExplicitOptionDeclarationTest()
{
string program = "Option Explicit Off\n";
OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
OptionDeclaration opDec = ParseUtil.ParseGlobal<OptionDeclaration>(program);
Assert.AreEqual(OptionType.Explicit, opDec.OptionType);
Assert.IsFalse(opDec.OptionValue, "Off option value excepted!");
}
@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetCompareBinaryOptionDeclarationTest()
{
string program = "Option Compare Binary\n";
OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
OptionDeclaration opDec = ParseUtil.ParseGlobal<OptionDeclaration>(program);
Assert.AreEqual(OptionType.CompareBinary, opDec.OptionType);
Assert.IsTrue(opDec.OptionValue);
}
@ -43,7 +43,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetCompareTextOptionDeclarationTest()
{
string program = "Option Compare Text\n";
OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
OptionDeclaration opDec = ParseUtil.ParseGlobal<OptionDeclaration>(program);
Assert.AreEqual(OptionType.CompareText, opDec.OptionType);
Assert.IsTrue(opDec.OptionValue);
}
@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetInferOnOptionDeclarationTest()
{
string program = "Option Infer On\n";
OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
OptionDeclaration opDec = ParseUtil.ParseGlobal<OptionDeclaration>(program);
Assert.AreEqual(OptionType.Infer, opDec.OptionType);
Assert.IsTrue(opDec.OptionValue);
}
@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetInferOffOptionDeclarationTest()
{
string program = "Option Infer\n";
OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
OptionDeclaration opDec = ParseUtil.ParseGlobal<OptionDeclaration>(program);
Assert.AreEqual(OptionType.Infer, opDec.OptionType);
Assert.IsTrue(opDec.OptionValue);
}
@ -70,7 +70,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetInferOptionDeclarationTest()
{
string program = "Option Infer\n";
OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
OptionDeclaration opDec = ParseUtil.ParseGlobal<OptionDeclaration>(program);
Assert.AreEqual(OptionType.Infer, opDec.OptionType);
Assert.IsTrue(opDec.OptionValue);
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "Class TestClass\n" +
"End Class\n";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(ClassType.Class, td.Type);
@ -31,7 +31,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetMissingBaseClassTest()
{
// SD2-1499: test that this invalid code doesn't crash
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>("public class test inherits", true);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>("public class test inherits", true);
Assert.AreEqual(0, td.BaseTypes.Count);
}
@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "Enum TestEnum As Byte\n" +
"End Enum\n";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestEnum", td.Name);
Assert.AreEqual(ClassType.Enum, td.Type);
@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetEnumOnSingleLine()
{
string program = "Enum TestEnum : A : B = 1 : C : End Enum";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestEnum", td.Name);
Assert.AreEqual(ClassType.Enum, td.Type);
@ -63,7 +63,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetEnumOnSingleLine2()
{
string program = "Enum TestEnum : A : : B = 1 :: C : End Enum";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestEnum", td.Name);
Assert.AreEqual(ClassType.Enum, td.Type);
@ -76,7 +76,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "Enum TestEnum As System.UInt16\n" +
"End Enum\n";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestEnum", td.Name);
Assert.AreEqual(ClassType.Enum, td.Type);
@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "Class TestClass\n" +
"End Class";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(ClassType.Class, td.Type);
@ -103,7 +103,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
string program = "Class TestClass\n" +
" : \n" +
"End Class";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(ClassType.Class, td.Type);
@ -114,7 +114,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = "Partial Class TestClass\n" +
"End Class\n";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(ClassType.Class, td.Type);
@ -125,7 +125,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetPartialPublicClass()
{
string program = "Partial Public Class TestClass\nEnd Class\n";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual("TestClass", td.Name);
Assert.AreEqual(ClassType.Class, td.Type);
@ -140,7 +140,7 @@ Public Class Test(Of T)
End Class
";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(declr);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(declr);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Test", td.Name);
@ -158,7 +158,7 @@ Public Class Test(Of T As IMyInterface)
End Class
";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(declr);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(declr);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Test", td.Name);
@ -177,7 +177,7 @@ Public Class Generic(Of T As MyNamespace.IMyInterface, S As {G(Of T()), IAnother
End Class
";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(declr);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(declr);
Assert.AreEqual(ClassType.Class, td.Type);
Assert.AreEqual("Generic", td.Name);

Просмотреть файл

@ -9,7 +9,7 @@ using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
public class ParseUtilVBNet
public class ParseUtil
{
public static T ParseGlobal<T>(string program) where T : INode
{

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void AddHandlerTest()
{
AddHandlerStatement addHandlerStatement = ParseUtilVBNet.ParseStatement<AddHandlerStatement>("AddHandler Obj.Ev_Event, AddressOf EventHandler");
AddHandlerStatement addHandlerStatement = ParseUtil.ParseStatement<AddHandlerStatement>("AddHandler Obj.Ev_Event, AddressOf EventHandler");
}
}
}

Просмотреть файл

@ -16,13 +16,13 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetEndStatementTest()
{
EndStatement endStatement = ParseUtilVBNet.ParseStatement<EndStatement>("End");
EndStatement endStatement = ParseUtil.ParseStatement<EndStatement>("End");
}
[Test]
public void VBNetEndStatementInIfThenTest2()
{
IfElseStatement endStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("IF a THEN End");
IfElseStatement endStatement = ParseUtil.ParseStatement<IfElseStatement>("IF a THEN End");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetEraseStatementTest()
{
EraseStatement eraseStatement = ParseUtilVBNet.ParseStatement<EraseStatement>("Erase a, b, c");
EraseStatement eraseStatement = ParseUtil.ParseStatement<EraseStatement>("Erase a, b, c");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetErrorStatementTest()
{
ErrorStatement errorStatement = ParseUtilVBNet.ParseStatement<ErrorStatement>("Error a");
ErrorStatement errorStatement = ParseUtil.ParseStatement<ErrorStatement>("Error a");
}
#endregion
}

Просмотреть файл

@ -16,13 +16,13 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetForNextStatementTest()
{
ForNextStatement forNextStatement = ParseUtilVBNet.ParseStatement<ForNextStatement>("For i=0 To 10 Step 2 : Next i");
ForNextStatement forNextStatement = ParseUtil.ParseStatement<ForNextStatement>("For i=0 To 10 Step 2 : Next i");
}
[Test]
public void VBNetForNextStatementWithComplexExpressionTest()
{
ForNextStatement forNextStatement = ParseUtilVBNet.ParseStatement<ForNextStatement>("For SomeMethod().Property = 0 To 10 : Next SomeMethod().Property");
ForNextStatement forNextStatement = ParseUtil.ParseStatement<ForNextStatement>("For SomeMethod().Property = 0 To 10 : Next SomeMethod().Property");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetForeachStatementTest()
{
ForeachStatement foreachStmt = ParseUtilVBNet.ParseStatement<ForeachStatement>("For Each i As Integer In myColl : Next");
ForeachStatement foreachStmt = ParseUtil.ParseStatement<ForeachStatement>("For Each i As Integer In myColl : Next");
// TODO : Extend test.
}
#endregion

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGotoStatementTest()
{
GotoStatement gotoStmt = ParseUtilVBNet.ParseStatement<GotoStatement>("GoTo myLabel");
GotoStatement gotoStmt = ParseUtil.ParseStatement<GotoStatement>("GoTo myLabel");
Assert.AreEqual("myLabel", gotoStmt.Label);
}
#endregion

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleIfStatementTest()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN END");
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN END");
Assert.IsFalse(ifElseStatement.Condition.IsNull);
Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
Assert.IsTrue(ifElseStatement.FalseStatement.Count == 0, "false count != 0:" + ifElseStatement.FalseStatement.Count);
@ -26,7 +26,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleIfStatementTest2()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n END\n END IF");
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN\n END\n END IF");
Assert.IsFalse(ifElseStatement.Condition.IsNull);
Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
Assert.IsTrue(ifElseStatement.FalseStatement.Count == 0, "false count != 0:" + ifElseStatement.FalseStatement.Count);
@ -38,7 +38,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetIfStatementLocationTest()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n" +
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN\n" +
"DoIt()\n" +
"ElseIf False Then\n" +
"DoIt()\n" +
@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetElseIfStatementTest()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n" +
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN\n" +
"END\n" +
"ElseIf False Then\n" +
"Stop\n" +
@ -70,7 +70,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetElse_IfStatementTest()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n" +
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN\n" +
"END\n" +
"Else If False Then\n" +
"Stop\n" +
@ -86,7 +86,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetMultiStatementIfStatementTest()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN Stop : b");
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN Stop : b");
Assert.IsFalse(ifElseStatement.Condition.IsNull);
Assert.AreEqual(2, ifElseStatement.TrueStatement.Count, "true count");
Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
@ -97,7 +97,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetMultiStatementIfStatementWithEndStatementTest()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN Stop : End : b");
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN Stop : End : b");
Assert.IsFalse(ifElseStatement.Condition.IsNull);
Assert.AreEqual(3, ifElseStatement.TrueStatement.Count, "true count");
Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
@ -110,7 +110,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetIfWithEmptyElseTest()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN a Else");
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN a Else");
Assert.IsFalse(ifElseStatement.Condition.IsNull);
Assert.AreEqual(1, ifElseStatement.TrueStatement.Count, "true count");
Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
@ -119,7 +119,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetIfWithMultipleColons()
{
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN a : : b");
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN a : : b");
Assert.IsFalse(ifElseStatement.Condition.IsNull);
Assert.AreEqual(2, ifElseStatement.TrueStatement.Count, "true count");
Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
@ -129,7 +129,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetIfWithSingleLineElse()
{
// This isn't legal according to the VB spec, but the MS VB compiler seems to allow it.
IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n" +
IfElseStatement ifElseStatement = ParseUtil.ParseStatement<IfElseStatement>("If True THEN\n" +
" x()\n" +
"Else y()\n" +
"End If");

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetLabelStatementTest()
{
MethodDeclaration method = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>("Sub Test \n myLabel: Console.WriteLine() \n End Sub");
MethodDeclaration method = ParseUtil.ParseTypeMember<MethodDeclaration>("Sub Test \n myLabel: Console.WriteLine() \n End Sub");
Assert.AreEqual(2, method.Body.Children.Count);
LabelStatement labelStmt = (LabelStatement)method.Body.Children[0];
Assert.AreEqual("myLabel", labelStmt.Label);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetLocalVariableDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As Integer = 5");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a As Integer = 5");
Assert.AreEqual(1, lvd.Variables.Count);
Assert.AreEqual("a", lvd.Variables[0].Name);
TypeReference type = lvd.GetTypeForVariable(0);
@ -27,7 +27,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetLocalVariableNamedOverrideDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim override As Integer = 5");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim override As Integer = 5");
Assert.AreEqual(1, lvd.Variables.Count);
Assert.AreEqual("override", lvd.Variables[0].Name);
TypeReference type = lvd.GetTypeForVariable(0);
@ -38,7 +38,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetLocalArrayDeclarationWithInitializationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a(10) As Integer");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a(10) As Integer");
Assert.AreEqual(1, lvd.Variables.Count);
Assert.AreEqual("a", lvd.Variables[0].Name);
TypeReference type = lvd.GetTypeForVariable(0);
@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetLocalArrayDeclarationWithInitializationAndLowerBoundTest()
{
// VB.NET allows only "0" as lower bound
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a(0 To 10) As Integer");
LocalVariableDeclaration lvd = ParseUtil.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);
@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetLocalArrayDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a() As Integer");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a() As Integer");
Assert.AreEqual(1, lvd.Variables.Count);
Assert.AreEqual("a", lvd.Variables[0].Name);
TypeReference type = lvd.GetTypeForVariable(0);
@ -80,7 +80,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetLocalJaggedArrayDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a(10)() As Integer");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a(10)() As Integer");
Assert.AreEqual(1, lvd.Variables.Count);
Assert.AreEqual("a", lvd.Variables[0].Name);
TypeReference type = lvd.GetTypeForVariable(0);
@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetComplexGenericLocalVariableDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim where As Generic(Of Printable, G(Of Printable()))");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim where As Generic(Of Printable, G(Of Printable()))");
Assert.AreEqual(1, lvd.Variables.Count);
Assert.AreEqual("where", lvd.Variables[0].Name);
TypeReference type = lvd.GetTypeForVariable(0);
@ -111,7 +111,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericWithArrayLocalVariableDeclarationTest1()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer)()");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer)()");
Assert.AreEqual(1, lvd.Variables.Count);
TypeReference type = lvd.GetTypeForVariable(0);
Assert.AreEqual("G", type.Type);
@ -125,7 +125,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericWithArrayLocalVariableDeclarationTest2()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer())");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer())");
Assert.AreEqual(1, lvd.Variables.Count);
TypeReference type = lvd.GetTypeForVariable(0);
Assert.AreEqual("G", type.Type);
@ -140,7 +140,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericLocalVariableDeclarationTest2()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of G(Of Integer))");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of G(Of Integer))");
Assert.AreEqual(1, lvd.Variables.Count);
TypeReference type = lvd.GetTypeForVariable(0);
Assert.AreEqual("G", type.Type);
@ -153,7 +153,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericLocalVariableDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer)");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer)");
Assert.AreEqual(1, lvd.Variables.Count);
TypeReference type = lvd.GetTypeForVariable(0);
Assert.AreEqual("G", type.Type);
@ -164,7 +164,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericLocalVariableInitializationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As New G(Of Integer)");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a As New G(Of Integer)");
Assert.AreEqual(1, lvd.Variables.Count);
TypeReference type = lvd.GetTypeForVariable(0);
Assert.AreEqual("G", type.Type);
@ -176,7 +176,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetNestedGenericLocalVariableDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a as MyType(of string).InnerClass(of integer).InnerInnerClass");
LocalVariableDeclaration lvd = ParseUtil.ParseStatement<LocalVariableDeclaration>("Dim a as MyType(of string).InnerClass(of integer).InnerInnerClass");
Assert.AreEqual(1, lvd.Variables.Count);
InnerClassTypeReference ic = (InnerClassTypeReference)lvd.GetTypeForVariable(0);
Assert.AreEqual("InnerInnerClass", ic.Type);
@ -193,7 +193,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetDimInSingleLineIf()
{
IfElseStatement ifes = ParseUtilVBNet.ParseStatement<IfElseStatement>("If a Then Dim b As String");
IfElseStatement ifes = ParseUtil.ParseStatement<IfElseStatement>("If a Then Dim b As String");
LocalVariableDeclaration lvd = (LocalVariableDeclaration)ifes.TrueStatement[0];
Assert.AreEqual(1, lvd.Variables.Count);
TypeReference type = lvd.GetTypeForVariable(0);

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetOnErrorStatementTest()
{
OnErrorStatement onErrorStatement = ParseUtilVBNet.ParseStatement<OnErrorStatement>("On Error Goto err");
OnErrorStatement onErrorStatement = ParseUtil.ParseStatement<OnErrorStatement>("On Error Goto err");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetRaiseEventStatementTest()
{
RaiseEventStatement raiseEventStatement = ParseUtilVBNet.ParseStatement<RaiseEventStatement>("RaiseEvent MyEvent(a, 5, (6))");
RaiseEventStatement raiseEventStatement = ParseUtil.ParseStatement<RaiseEventStatement>("RaiseEvent MyEvent(a, 5, (6))");
}
#endregion
}

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetReDimStatementTest()
{
ReDimStatement reDimStatement = ParseUtilVBNet.ParseStatement<ReDimStatement>("ReDim Preserve MyArray(15)");
ReDimStatement reDimStatement = ParseUtil.ParseStatement<ReDimStatement>("ReDim Preserve MyArray(15)");
Assert.AreEqual(1, reDimStatement.ReDimClauses.Count);
Assert.AreSame(reDimStatement, reDimStatement.ReDimClauses[0].Parent);
}
@ -23,7 +23,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetReDimStatementTest2()
{
ReDimStatement reDimStatement = ParseUtilVBNet.ParseStatement<ReDimStatement>("ReDim calCheckData(channelNum, lambdaNum).ShiftFromLastFullCalPixels(CalCheckPeak.HighWavelength)");
ReDimStatement reDimStatement = ParseUtil.ParseStatement<ReDimStatement>("ReDim calCheckData(channelNum, lambdaNum).ShiftFromLastFullCalPixels(CalCheckPeak.HighWavelength)");
}
[Test]
@ -71,7 +71,7 @@ Class X
ReDim SomeType(Of Integer).IntArray(0 To 10, 10, 0 To 20)
End Sub
End Class";
TypeDeclaration typeDeclaration = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration typeDeclaration = ParseUtil.ParseGlobal<TypeDeclaration>(program);
}
}
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetRemoveHandlerTest()
{
RemoveHandlerStatement removeHandlerStatement = ParseUtilVBNet.ParseStatement<RemoveHandlerStatement>("RemoveHandler MyHandler, AddressOf MyMethod");
RemoveHandlerStatement removeHandlerStatement = ParseUtil.ParseStatement<RemoveHandlerStatement>("RemoveHandler MyHandler, AddressOf MyMethod");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetResumeStatementTest()
{
ResumeStatement resumeStatement = ParseUtilVBNet.ParseStatement<ResumeStatement>("Resume");
ResumeStatement resumeStatement = ParseUtil.ParseStatement<ResumeStatement>("Resume");
}
#endregion
}

Просмотреть файл

@ -16,14 +16,14 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetEmptyReturnStatementTest()
{
ReturnStatement returnStatement = ParseUtilVBNet.ParseStatement<ReturnStatement>("Return");
ReturnStatement returnStatement = ParseUtil.ParseStatement<ReturnStatement>("Return");
Assert.IsTrue(returnStatement.Expression.IsNull);
}
[Test]
public void VBNetReturnStatementTest()
{
ReturnStatement returnStatement = ParseUtilVBNet.ParseStatement<ReturnStatement>("Return 5");
ReturnStatement returnStatement = ParseUtil.ParseStatement<ReturnStatement>("Return 5");
Assert.IsFalse(returnStatement.Expression.IsNull);
Assert.IsTrue(returnStatement.Expression is PrimitiveExpression);
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetStopStatementTest()
{
StopStatement stopStatement = ParseUtilVBNet.ParseStatement<StopStatement>("Stop");
StopStatement stopStatement = ParseUtil.ParseStatement<StopStatement>("Stop");
}
#endregion
}

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBSwitchStatementTest()
{
SwitchStatement switchStmt = ParseUtilVBNet.ParseStatement<SwitchStatement>("Select Case a\n Case 4, 5\n Case 6\n Case Else\n End Select");
SwitchStatement switchStmt = ParseUtil.ParseStatement<SwitchStatement>("Select Case a\n Case 4, 5\n Case 6\n Case Else\n End Select");
Assert.AreEqual("a", ((IdentifierExpression)switchStmt.SwitchExpression).Identifier);
// TODO: Extend test
}
@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void InvalidVBSwitchStatementTest()
{
SwitchStatement switchStmt = ParseUtilVBNet.ParseStatement<SwitchStatement>("Select Case a\n Case \n End Select", true);
SwitchStatement switchStmt = ParseUtil.ParseStatement<SwitchStatement>("Select Case a\n Case \n End Select", true);
Assert.AreEqual("a", ((IdentifierExpression)switchStmt.SwitchExpression).Identifier);
SwitchSection sec = switchStmt.SwitchSections[0];
Assert.AreEqual(0, sec.SwitchLabels.Count);

Просмотреть файл

@ -21,7 +21,7 @@ Using nf As New System.Drawing.Font(""Arial"", 12.0F, FontStyle.Bold)
c.Font = nf
c.Text = ""This is 12-point Arial bold""
End Using";
UsingStatement usingStmt = ParseUtilVBNet.ParseStatement<UsingStatement>(usingText);
UsingStatement usingStmt = ParseUtil.ParseStatement<UsingStatement>(usingText);
// TODO : Extend test.
}
[Test]
@ -31,7 +31,7 @@ End Using";
Using nf As Font = New Font()
Bla(nf)
End Using";
UsingStatement usingStmt = ParseUtilVBNet.ParseStatement<UsingStatement>(usingText);
UsingStatement usingStmt = ParseUtil.ParseStatement<UsingStatement>(usingText);
// TODO : Extend test.
}
[Test]
@ -41,7 +41,7 @@ End Using";
Using nf As New Font(), nf2 As New List(Of Font)(), nf3 = Nothing
Bla(nf)
End Using";
UsingStatement usingStmt = ParseUtilVBNet.ParseStatement<UsingStatement>(usingText);
UsingStatement usingStmt = ParseUtil.ParseStatement<UsingStatement>(usingText);
// TODO : Extend test.
}
#endregion

Просмотреть файл

@ -16,7 +16,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetWithStatementTest()
{
WithStatement withStatement = ParseUtilVBNet.ParseStatement<WithStatement>("With MyObj : End With");
WithStatement withStatement = ParseUtil.ParseStatement<WithStatement>("With MyObj : End With");
}
#endregion
}

Просмотреть файл

@ -16,14 +16,14 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
string program = @"Sub New()
End Sub";
ConstructorDeclaration cd = ParseUtilVBNet.ParseTypeMember<ConstructorDeclaration>(program);
ConstructorDeclaration cd = ParseUtil.ParseTypeMember<ConstructorDeclaration>(program);
Assert.IsTrue(cd.ConstructorInitializer.IsNull);
}
[Test]
public void VBNetConstructorDeclarationTest2()
{
ConstructorDeclaration cd = ParseUtilVBNet.ParseTypeMember<ConstructorDeclaration>("Sub New(x As Integer, Optional y As String) \nEnd Sub");
ConstructorDeclaration cd = ParseUtil.ParseTypeMember<ConstructorDeclaration>("Sub New(x As Integer, Optional y As String) \nEnd Sub");
Assert.AreEqual(2, cd.Parameters.Count);
Assert.AreEqual("System.Int32", cd.Parameters[0].TypeReference.Type);
Assert.AreEqual("System.String", cd.Parameters[1].TypeReference.Type);

Просмотреть файл

@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
End If
End RaiseEvent
End Event";
EventDeclaration customEventDecl = ParseUtilVBNet.ParseTypeMember<EventDeclaration>(code);
EventDeclaration customEventDecl = ParseUtil.ParseTypeMember<EventDeclaration>(code);
Assert.IsNotNull(customEventDecl);
Assert.AreEqual("TestEvent", customEventDecl.Name);
}

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetDeclareDeclarationTest()
{
string program = "Declare Ansi Function GetUserName Lib \"advapi32.dll\" Alias \"GetUserNameA\" (ByVal lpBuffer As String, ByRef nSize As Integer) As Integer\n";
DeclareDeclaration dd = ParseUtilVBNet.ParseTypeMember<DeclareDeclaration>(program);
DeclareDeclaration dd = ParseUtil.ParseTypeMember<DeclareDeclaration>(program);
Assert.AreEqual("System.Int32", dd.TypeReference.Type);
Assert.AreEqual("GetUserName", dd.Name);
Assert.AreEqual("advapi32.dll", dd.Library);

Просмотреть файл

@ -14,7 +14,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleEventDeclarationTest()
{
EventDeclaration ed = ParseUtilVBNet.ParseTypeMember<EventDeclaration>("event MyEvent(x as Integer)");
EventDeclaration ed = ParseUtil.ParseTypeMember<EventDeclaration>("event MyEvent(x as Integer)");
Assert.AreEqual(1, ed.Parameters.Count);
Assert.AreEqual("MyEvent", ed.Name);
Assert.IsFalse(ed.HasAddRegion);

Просмотреть файл

@ -14,7 +14,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleFieldDeclarationTest()
{
FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("myField As Integer(,,,)");
FieldDeclaration fd = ParseUtil.ParseTypeMember<FieldDeclaration>("myField As Integer(,,,)");
Assert.AreEqual(1, fd.Fields.Count);
Assert.AreEqual("System.Int32", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
@ -26,7 +26,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetMultiFieldDeclarationTest()
{
FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("a, b As String");
FieldDeclaration fd = ParseUtil.ParseTypeMember<FieldDeclaration>("a, b As String");
Assert.AreEqual(2, fd.Fields.Count);
Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
@ -39,7 +39,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetMultiFieldsOnSingleLineTest()
{
string program = "Class TestClass : Dim a : Dim b : End Class";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
Assert.AreEqual(2, td.Children.Count);
Assert.IsTrue(td.Children[0] is FieldDeclaration);
@ -49,7 +49,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetMultiFieldDeclarationTest2()
{
FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("Dim a, b() As String");
FieldDeclaration fd = ParseUtil.ParseTypeMember<FieldDeclaration>("Dim a, b() As String");
Assert.AreEqual(2, fd.Fields.Count);
Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetMultiFieldDeclarationTest3()
{
FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("Dim a(), b As String");
FieldDeclaration fd = ParseUtil.ParseTypeMember<FieldDeclaration>("Dim a(), b As String");
Assert.AreEqual(2, fd.Fields.Count);
Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetDefiningPartialMethodDeclarationTest()
{
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(@"Partial Sub MyMethod()
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(@"Partial Sub MyMethod()
End Sub");
Assert.AreEqual(0, md.Parameters.Count);
Assert.AreEqual("MyMethod", md.Name);
@ -30,7 +30,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
OtherMethod()
end sub";
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(program);
Assert.AreEqual(Modifiers.Public | Modifiers.Static, md.Modifier);
Assert.AreEqual(2, md.StartLocation.Line, "StartLocation.Y");
Assert.AreEqual(2, md.EndLocation.Line, "EndLocation.Y");
@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
return 1
end function";
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(program);
Assert.AreEqual(Modifiers.Public, md.Modifier);
Assert.AreEqual(2, md.StartLocation.Line, "StartLocation.Y");
Assert.AreEqual(2, md.StartLocation.Column, "StartLocation.X");
@ -58,7 +58,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
OtherMethod()
end Sub";
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(program);
Assert.AreEqual(Modifiers.Public, md.Modifier);
Assert.AreEqual(2, md.StartLocation.Line, "StartLocation.Y");
Assert.AreEqual(2, md.StartLocation.Column, "StartLocation.X");
@ -68,7 +68,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericFunctionMethodDeclarationTest()
{
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>("function MyMethod(Of T)(a As T) As Double\nEnd Function");
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>("function MyMethod(Of T)(a As T) As Double\nEnd Function");
Assert.AreEqual("System.Double", md.TypeReference.Type);
Assert.AreEqual(1, md.Parameters.Count);
Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
@ -81,7 +81,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetGenericMethodDeclarationTest()
{
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>("Function MyMethod(Of T)(a As T) As T\nEnd Function ");
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>("Function MyMethod(Of T)(a As T) As T\nEnd Function ");
Assert.AreEqual("T", md.TypeReference.Type);
Assert.AreEqual(1, md.Parameters.Count);
Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
public void VBNetGenericMethodDeclarationWithConstraintTest()
{
string program = "Function MyMethod(Of T As { ISomeInterface })(a As T) As T\n End Function";
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(program);
Assert.AreEqual("T", md.TypeReference.Type);
Assert.AreEqual(1, md.Parameters.Count);
Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
@ -110,7 +110,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetExtensionMethodDeclaration()
{
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(
@"<Extension> _
Sub Print(s As String)
Console.WriteLine(s)
@ -131,7 +131,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
const string program = @"Interface MyInterface
Function MyMethod(Of T As {ISomeInterface})(a As T) As T
End Interface";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
MethodDeclaration md = (MethodDeclaration)td.Children[0];
Assert.AreEqual("T", md.TypeReference.Type);
Assert.AreEqual(1, md.Parameters.Count);
@ -151,7 +151,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
Sub MyMethod(Of T As {ISomeInterface})(a as T)
End Interface
";
TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
TypeDeclaration td = ParseUtil.ParseGlobal<TypeDeclaration>(program);
MethodDeclaration md = (MethodDeclaration)td.Children[0];
Assert.AreEqual("System.Void", md.TypeReference.Type);
Assert.AreEqual(1, md.Parameters.Count);
@ -167,17 +167,17 @@ End Interface
[Test]
public void VBNetMethodWithHandlesClause()
{
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(
@"Public Sub MyMethod(sender As Object, e As EventArgs) Handles x.y
End Sub");
Assert.AreEqual(new string[] { "x.y" }, md.HandlesClause.ToArray());
md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
md = ParseUtil.ParseTypeMember<MethodDeclaration>(
@"Public Sub MyMethod() Handles Me.FormClosing
End Sub");
Assert.AreEqual(new string[] { "Me.FormClosing" }, md.HandlesClause.ToArray());
md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
md = ParseUtil.ParseTypeMember<MethodDeclaration>(
@"Public Sub MyMethod() Handles MyBase.Event, Button1.Click
End Sub");
Assert.AreEqual(new string[] { "MyBase.Event", "Button1.Click" }, md.HandlesClause.ToArray());
@ -190,7 +190,7 @@ End Interface
Func! = CSingle(Param&)
End Function";
MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
MethodDeclaration md = ParseUtil.ParseTypeMember<MethodDeclaration>(program);
Assert.AreEqual(Modifiers.Public, md.Modifier);
}

Просмотреть файл

@ -19,7 +19,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
Return v
End Operator";
OperatorDeclaration od = ParseUtilVBNet.ParseTypeMember<OperatorDeclaration>(programm);
OperatorDeclaration od = ParseUtil.ParseTypeMember<OperatorDeclaration>(programm);
Assert.IsFalse(od.IsConversionOperator);
Assert.AreEqual(1, od.Parameters.Count);
Assert.AreEqual(ConversionType.None, od.ConversionType);

Просмотреть файл

@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleGetSetPropertyDeclarationTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty As Integer \n Get \n End Get \n Set \n End Set\nEnd Property");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("Property MyProperty As Integer \n Get \n End Get \n Set \n End Set\nEnd Property");
Assert.AreEqual("MyProperty", pd.Name);
Assert.IsTrue(pd.HasGetRegion);
Assert.IsTrue(pd.HasSetRegion);
@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleGetPropertyDeclarationTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("ReadOnly Property MyProperty \nGet\nEnd Get\nEnd Property");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("ReadOnly Property MyProperty \nGet\nEnd Get\nEnd Property");
Assert.AreEqual("MyProperty", pd.Name);
Assert.IsTrue(pd.HasGetRegion);
Assert.IsFalse(pd.HasSetRegion);
@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleSetPropertyDeclarationTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("WriteOnly Property MyProperty \n Set\nEnd Set\nEnd Property ");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("WriteOnly Property MyProperty \n Set\nEnd Set\nEnd Property ");
Assert.AreEqual("MyProperty", pd.Name);
Assert.IsFalse(pd.HasGetRegion);
Assert.IsTrue(pd.HasSetRegion);
@ -44,7 +44,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetAutoPropertyTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("Property MyProperty");
Assert.AreEqual("MyProperty", pd.Name);
Assert.IsTrue(pd.HasGetRegion);
Assert.IsTrue(pd.HasSetRegion);
@ -54,7 +54,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetReadOnlyAutoPropertyTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("ReadOnly Property MyProperty");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("ReadOnly Property MyProperty");
Assert.AreEqual("MyProperty", pd.Name);
Assert.IsTrue(pd.HasGetRegion);
Assert.IsFalse(pd.HasSetRegion);
@ -64,7 +64,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetWriteOnlyAutoPropertyTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("WriteOnly Property MyProperty");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("WriteOnly Property MyProperty");
Assert.AreEqual("MyProperty", pd.Name);
Assert.IsFalse(pd.HasGetRegion);
Assert.IsTrue(pd.HasSetRegion);
@ -74,7 +74,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleInitializerAutoPropertyTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty = 5");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("Property MyProperty = 5");
Assert.AreEqual("MyProperty", pd.Name);
Assert.IsTrue(pd.HasGetRegion);
Assert.IsTrue(pd.HasSetRegion);
@ -84,7 +84,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleInitializerAutoPropertyWithTypeTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty As Integer = 5");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("Property MyProperty As Integer = 5");
Assert.AreEqual("MyProperty", pd.Name);
Assert.AreEqual("System.Int32", pd.TypeReference.Type);
Assert.IsTrue(pd.HasGetRegion);
@ -95,7 +95,7 @@ namespace ICSharpCode.NRefactory.VB.Tests.Dom
[Test]
public void VBNetSimpleObjectInitializerAutoPropertyTest()
{
PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty As New List");
PropertyDeclaration pd = ParseUtil.ParseTypeMember<PropertyDeclaration>("Property MyProperty As New List");
Assert.AreEqual("MyProperty", pd.Name);
Assert.AreEqual("List", pd.TypeReference.Type);
Assert.IsTrue(pd.HasGetRegion);