Browse Source

Allow references to unbound types in typeof/GetType expressions.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@529 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
8afa7cc805
  1. 4
      src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs
  2. 5
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs
  3. 8
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs
  4. 1
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs
  5. 2486
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  6. 109
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
  7. 927
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  8. 45
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  9. 99
      src/Libraries/NRefactory/Test/Parser/Expressions/TypeOfExpressionTests.cs

4
src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs

@ -92,10 +92,10 @@ namespace HtmlHelp2.OptionsPanel @@ -92,10 +92,10 @@ namespace HtmlHelp2.OptionsPanel
#region ReRegister
void ReregisterButtonClick(object sender, EventArgs e)
{
new MethodInvoker(DoReregister).BeginInvoke(null, null);
System.Threading.ThreadPool.QueueUserWorkItem(DoReregister);
}
void DoReregister()
void DoReregister(object state)
{
try
{

5
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.Collections;
using System.Drawing;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using NSvn.Common;
@ -95,7 +96,7 @@ namespace ICSharpCode.Svn @@ -95,7 +96,7 @@ namespace ICSharpCode.Svn
if (!isLoadingChangedPaths) {
isLoadingChangedPaths = true;
loadChangedPathsItem = item;
new MethodInvoker(LoadChangedPaths).BeginInvoke(null, null);
ThreadPool.QueueUserWorkItem(LoadChangedPaths);
}
} else {
int pathWidth = 70;
@ -133,7 +134,7 @@ namespace ICSharpCode.Svn @@ -133,7 +134,7 @@ namespace ICSharpCode.Svn
ListViewItem loadChangedPathsItem;
volatile bool isLoadingChangedPaths;
void LoadChangedPaths()
void LoadChangedPaths(object state)
{
try {
LogMessage logMessage = (LogMessage)loadChangedPathsItem.Tag;

8
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs

@ -91,7 +91,7 @@ namespace ICSharpCode.Svn @@ -91,7 +91,7 @@ namespace ICSharpCode.Svn
lock (queue) {
queue.Enqueue(node);
if (queue.Count == 1) {
new ThreadStart(Run).BeginInvoke(null, null);
ThreadPool.QueueUserWorkItem(Run);
}
}
}
@ -117,14 +117,14 @@ namespace ICSharpCode.Svn @@ -117,14 +117,14 @@ namespace ICSharpCode.Svn
}
if (wasEmpty) {
new ThreadStart(Run).BeginInvoke(null, null);
ThreadPool.QueueUserWorkItem(Run);
}
}
}
static Client client;
static void Run()
static void Run(object state)
{
LoggingService.Debug("SVN: OverlayIconManager Thread started");
Thread.Sleep(2); // sleep 1 ms to give main thread time to add more jobs to the queue
@ -164,7 +164,7 @@ namespace ICSharpCode.Svn @@ -164,7 +164,7 @@ namespace ICSharpCode.Svn
}
}
if (node.TreeView != null) {
node.TreeView.BeginInvoke(new ThreadStart(delegate {
node.TreeView.BeginInvoke(new MethodInvoker(delegate {
node.Overlay = GetImage(status);
}));
}

1
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs

@ -264,7 +264,6 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow @@ -264,7 +264,6 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow
control.Document.Remove(startOffset, endOffset - startOffset);
}
if (dataProvider.InsertSpace) {
Console.WriteLine("Inserting space..");
control.Document.Insert(startOffset++, " ");
}
control.ActiveTextAreaControl.Caret.Position = control.Document.OffsetToPosition(startOffset);

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

File diff suppressed because it is too large Load Diff

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

@ -21,12 +21,14 @@ public string ContainingAssembly { @@ -21,12 +21,14 @@ public string ContainingAssembly {
}
Token t {
[System.Diagnostics.DebuggerStepThrough]
get {
return lexer.Token;
}
}
Token la {
[System.Diagnostics.DebuggerStepThrough]
get {
return lexer.LookAhead;
}
@ -890,8 +892,8 @@ ClassBase<out List<TypeReference> names> @@ -890,8 +892,8 @@ ClassBase<out List<TypeReference> names>
names = new List<TypeReference>();
.)
=
":" ClassType<out typeRef> (. if (typeRef != null) { names.Add(typeRef); } .)
{ "," TypeName<out typeRef> (. if (typeRef != null) { names.Add(typeRef); } .) }
":" ClassType<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .)
{ "," TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .) }
.
ClassBody
@ -914,8 +916,8 @@ StructInterfaces<out List<TypeReference> names> @@ -914,8 +916,8 @@ StructInterfaces<out List<TypeReference> names>
names = new List<TypeReference>();
.)
=
":" TypeName<out typeRef> (. if (typeRef != null) { names.Add(typeRef); } .)
{ "," TypeName<out typeRef> (. if (typeRef != null) { names.Add(typeRef); } .) }
":" TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .)
{ "," TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .) }
.
StructBody
@ -938,8 +940,8 @@ InterfaceBase<out List<TypeReference> names> @@ -938,8 +940,8 @@ InterfaceBase<out List<TypeReference> names>
names = new List<TypeReference>();
.)
=
":" TypeName<out typeRef> (. if (typeRef != null) { names.Add(typeRef); } .)
{ "," TypeName<out typeRef> (. if (typeRef != null) { names.Add(typeRef); } .) }
":" TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .)
{ "," TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .) }
.
InterfaceBody
@ -954,45 +956,24 @@ EnumBody (. FieldDeclaration f; .) @@ -954,45 +956,24 @@ EnumBody (. FieldDeclaration f; .)
.
Type<out TypeReference type>
(.
string name;
int pointer = 0;
type = null;
.)
=
( ClassType<out type>
| SimpleType<out name> (. type = new TypeReference(name); .)
[ NullableQuestionMark<ref type> ]
| "void" "*" (. pointer = 1; type = new TypeReference("void"); .)
) (. List<int> r = new List<int>(); .)
{ IF (IsPointerOrDims()) (. int i = 0; .)
( "*" (. ++pointer; .)
| "[" { "," (. ++i; .) } "]" (. r.Add(i); .)
)
}
(. if (type != null) {
type.RankSpecifier = r.ToArray();
type.PointerNestingLevel = pointer;
}
.)
TypeWithRestriction<out type, true, false>
.
TypeWONullableQuestionMark<out TypeReference type>
TypeWithRestriction<out TypeReference type, bool allowNullable, bool canBeUnbound>
(.
string name;
int pointer = 0;
type = null;
.)
=
( ClassTypeWONullableQuestionMark<out type>
( ClassType<out type, canBeUnbound>
| SimpleType<out name> (. type = new TypeReference(name); .)
| "void" "*" (. pointer = 1; type = new TypeReference("void"); .)
) (. List<int> r = new List<int>(); .)
[ IF (allowNullable && la.kind == Tokens.Question) NullableQuestionMark<ref type> ]
{ IF (IsPointerOrDims()) (. int i = 0; .)
( "*" (. ++pointer; .)
| "[" { "," (. ++i; .) } "]" (. r.Add(i); .)
@ -1013,12 +994,13 @@ NonArrayType<out TypeReference type> @@ -1013,12 +994,13 @@ NonArrayType<out TypeReference type>
type = null;
.)
=
( ClassType<out type>
( ClassType<out type, false>
| SimpleType<out name> (. type = new TypeReference(name); .)
[ NullableQuestionMark<ref type> ]
| "void" "*" (. pointer = 1; type = new TypeReference("void"); .)
)
[ NullableQuestionMark<ref type> ]
{ IF (IsPointer())
"*" (. ++pointer; .)
}
@ -1106,18 +1088,10 @@ TypeModifier<Modifiers m> @@ -1106,18 +1088,10 @@ TypeModifier<Modifiers m>
| ident (. if (t.val == "partial") { m.Add(Modifier.Partial, t.Location); } .)
.
ClassType<out TypeReference typeRef>
(. TypeReference r; typeRef = null; .)
=
TypeName<out r> (. typeRef = r; .)
| "object" (. typeRef = new TypeReference("object"); .)
| "string" (. typeRef = new TypeReference("string"); .)
.
ClassTypeWONullableQuestionMark<out TypeReference typeRef>
ClassType<out TypeReference typeRef, bool canBeUnbound>
(. TypeReference r; typeRef = null; .)
=
TypeNameWONullableQuestionMark<out r> (. typeRef = r; .)
TypeName<out r, canBeUnbound> (. typeRef = r; .)
| "object" (. typeRef = new TypeReference("object"); .)
| "string" (. typeRef = new TypeReference("string"); .)
.
@ -1945,11 +1919,11 @@ CatchClauses<out ArrayList catchClauses> @@ -1945,11 +1919,11 @@ CatchClauses<out ArrayList catchClauses>
(
Block<out stmt> (. catchClauses.Add(new CatchClause(stmt)); .)
/*--- specific catch clause */
| "(" ClassType<out typeRef> (. identifier = null; .)
| "(" ClassType<out typeRef, false> (. identifier = null; .)
[ ident (. identifier = t.val; .) ]
")" Block<out stmt>
(. catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); .)
{ IF (IsTypedCatch()) "catch" "(" ClassType<out typeRef> (. identifier = null; .)
{ IF (IsTypedCatch()) "catch" "(" ClassType<out typeRef, false> (. identifier = null; .)
[ ident (. identifier = t.val; .) ]
")" Block<out stmt>
(. catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); .) }
@ -2074,7 +2048,7 @@ PrimaryExpr<out Expression pexpr> @@ -2074,7 +2048,7 @@ PrimaryExpr<out Expression pexpr>
| "null" (.pexpr = new PrimitiveExpression(null, "null"); .) /* from literal token */
| Literal (.pexpr = new PrimitiveExpression(t.literalValue, t.val); .)
| IF (la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon)
TypeName<out type> (. pexpr = new TypeReferenceExpression(type); .)
TypeName<out type, false> (. pexpr = new TypeReferenceExpression(type); .)
/*--- simple name: */
| ident (. pexpr = new IdentifierExpression(t.val); .)
/*--- parenthesized expression: */
@ -2152,7 +2126,7 @@ PrimaryExpr<out Expression pexpr> @@ -2152,7 +2126,7 @@ PrimaryExpr<out Expression pexpr>
| "typeof" "("
(
IF (NotVoidPointer()) "void" (. type = new TypeReference("void"); .)
| Type<out type>
| TypeWithRestriction<out type, true, true>
) ")" (. pexpr = new TypeOfExpression(type); .)
| IF (la.kind == Tokens.Default && Peek(1).kind == Tokens.OpenParenthesis)
@ -2288,7 +2262,8 @@ RelationalExpr<ref Expression outExpr> @@ -2288,7 +2262,8 @@ RelationalExpr<ref Expression outExpr>
"is" (. op = BinaryOperatorType.TypeCheck; .)
| "as" (. op = BinaryOperatorType.AsCast; .)
)
TypeWONullableQuestionMark<out type> (. outExpr = new BinaryOperatorExpression(outExpr, op, new TypeReferenceExpression(type)); .)
TypeWithRestriction<out type, false, false>
(. outExpr = new BinaryOperatorExpression(outExpr, op, new TypeReferenceExpression(type)); .)
}
.
@ -2343,7 +2318,7 @@ MultiplicativeExpr<ref Expression outExpr> @@ -2343,7 +2318,7 @@ MultiplicativeExpr<ref Expression outExpr>
/* .NET 2.0 rules */
TypeName<out TypeReference typeRef>
TypeName<out TypeReference typeRef, bool canBeUnbound>
(. List<TypeReference> typeArguments = null;
string alias = null;
string qualident;
@ -2354,32 +2329,14 @@ TypeName<out TypeReference typeRef> @@ -2354,32 +2329,14 @@ TypeName<out TypeReference typeRef>
"::"
]
Qualident<out qualident>
[ TypeArgumentList<out typeArguments> ]
(.
if (alias == null) {
typeRef = new TypeReference(qualident, typeArguments);
} else if (alias == "global") {
typeRef = new TypeReference(qualident, typeArguments);
typeRef.IsGlobal = true;
} else {
typeRef = new TypeReference(alias + "." + qualident, typeArguments);
}
.)
[ NullableQuestionMark<ref typeRef> ]
.
TypeNameWONullableQuestionMark<out TypeReference typeRef>
(. List<TypeReference> typeArguments = null;
string alias = null;
string qualident;
.)
=
[ IF (la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon)
ident (. alias = t.val; .)
"::"
]
Qualident<out qualident>
[ TypeArgumentList<out typeArguments> ]
( IF (canBeUnbound && la.kind == Tokens.LessThan && (Peek(1).kind == Tokens.GreaterThan || Peek(1).kind == Tokens.Comma))
(. typeArguments = new List<TypeReference>(); .)
"<"
(. typeArguments.Add(NullTypeReference.Instance); .)
{ "," (. typeArguments.Add(NullTypeReference.Instance); .) }
">"
| [TypeArgumentList<out typeArguments>]
)
(.
if (alias == null) {
typeRef = new TypeReference(qualident, typeArguments);

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

File diff suppressed because it is too large Load Diff

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

@ -1714,7 +1714,7 @@ SimpleExpr<out Expression pexpr> @@ -1714,7 +1714,7 @@ SimpleExpr<out Expression pexpr>
| /* 11.11 */ "TryCast" "(" Expr<out expr> "," TypeName<out type> ")" (. pexpr = new BinaryOperatorExpression(expr, BinaryOperatorType.AsCast, new TypeReferenceExpression(type)); .)
| /* 11.11 */ CastTarget<out type> "(" Expr<out expr> ")" (. pexpr = new CastExpression(type, expr, true); .)
| /* 11.4.5 */ "AddressOf" Expr<out expr> (. pexpr = new AddressOfExpression(expr); .)
| /* 11.5.1 */ "GetType" "(" TypeName<out type> ")" (. pexpr = new TypeOfExpression(type); .)
| /* 11.5.1 */ "GetType" "(" GetTypeTypeName<out type> ")" (. pexpr = new TypeOfExpression(type); .)
| /* 11.5.2 */ "TypeOf" SimpleExpr<out expr> "Is" TypeName<out type> (. pexpr = new TypeOfIsExpression(expr, type); .)
)
{
@ -1899,7 +1899,7 @@ ObjectCreateExpression<out Expression oce> @@ -1899,7 +1899,7 @@ ObjectCreateExpression<out Expression oce>
ArrayList arguments = null;
oce = null;
.) =
"New" NonArrayTypeName<out type>
"New" NonArrayTypeName<out type, false>
["(" [ ArgumentList<out arguments> ] ")" ]
[ ArrayInitializer<out initializer> ]
(.
@ -1945,36 +1945,53 @@ Argument<out Expression argumentexpr> @@ -1945,36 +1945,53 @@ Argument<out Expression argumentexpr>
/* 7.1. */
TypeName<out TypeReference typeref>
(. ArrayList rank = null; typeref = null; .)
(. ArrayList rank = null; .)
=
NonArrayTypeName<out typeref>
NonArrayTypeName<out typeref, false>
ArrayTypeModifiers<out rank>
(.
if (rank != null && typeref != null) {
(. if (rank != null && typeref != null) {
typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
.)
.
GetTypeTypeName<out TypeReference typeref>
(. ArrayList rank = null; .)
=
NonArrayTypeName<out typeref, true>
ArrayTypeModifiers<out rank>
(. if (rank != null && typeref != null) {
typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
.)
.
/* 7.1 */
NonArrayTypeName<out TypeReference typeref>
NonArrayTypeName<out TypeReference typeref, bool canBeUnbound>
(.
string name;
typeref = null;
bool isGlobal = false;
.) =
Qualident<out name> (. typeref = new TypeReference(name); .)
(
[ "Global" "." (. isGlobal = true; .) ]
Qualident<out name>
(. typeref = new TypeReference(name); typeref.IsGlobal = isGlobal; .)
[IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
"(" "Of" TypeArgumentList<typeref.GenericTypes> ")"
"(" "Of"
( IF (canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma))
(. typeref.GenericTypes.Add(NullTypeReference.Instance); .)
{ "," (. typeref.GenericTypes.Add(NullTypeReference.Instance); .) }
| TypeArgumentList<typeref.GenericTypes>
)
")"
]
)
| "Object" (. typeref = new TypeReference("System.Object"); .)
| "Global" "." Qualident<out name>
(. typeref = new TypeReference(name); typeref.IsGlobal = true; .)
[IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
"(" "Of" TypeArgumentList<typeref.GenericTypes> ")"
]
| PrimitiveTypeName<out name> (. typeref = new TypeReference(name); .)
.
/* 7.9 */
ArrayNameModifier<out ArrayList arrayModifiers>
(.

99
src/Libraries/NRefactory/Test/Parser/Expressions/TypeOfExpressionTests.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
@ -24,22 +24,115 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -24,22 +24,115 @@ namespace ICSharpCode.NRefactory.Tests.AST
Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
}
[Test]
public void CSharpGlobalTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilCSharp.ParseExpression("typeof(global::System.Console)", typeof(TypeOfExpression));
Assert.AreEqual("System.Console", toe.TypeReference.Type);
}
[Test]
public void CSharpPrimitiveTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilCSharp.ParseExpression("typeof(int)", typeof(TypeOfExpression));
Assert.AreEqual("System.Int32", toe.TypeReference.SystemType);
}
[Test]
public void CSharpVoidTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilCSharp.ParseExpression("typeof(void)", typeof(TypeOfExpression));
Assert.AreEqual("System.Void", toe.TypeReference.SystemType);
}
[Test]
public void CSharpArrayTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilCSharp.ParseExpression("typeof(MyType[])", typeof(TypeOfExpression));
Assert.AreEqual("MyType", toe.TypeReference.Type);
Assert.AreEqual(new int[] {0}, toe.TypeReference.RankSpecifier);
}
[Test]
public void CSharpGenericTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilCSharp.ParseExpression("typeof(MyNamespace.N1.MyType<string>)", typeof(TypeOfExpression));
Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
Assert.AreEqual("string", toe.TypeReference.GenericTypes[0].Type);
Assert.AreEqual("System.String", toe.TypeReference.GenericTypes[0].SystemType);
}
[Test]
public void CSharpNullableTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilCSharp.ParseExpression("typeof(MyStruct?)", typeof(TypeOfExpression));
Assert.AreEqual("System.Nullable", toe.TypeReference.SystemType);
Assert.AreEqual("MyStruct", toe.TypeReference.GenericTypes[0].Type);
}
[Test]
public void CSharpUnboundTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilCSharp.ParseExpression("typeof(MyType<,>)", typeof(TypeOfExpression));
Assert.AreEqual("MyType", toe.TypeReference.Type);
Assert.IsTrue(toe.TypeReference.GenericTypes[0].IsNull);
Assert.IsTrue(toe.TypeReference.GenericTypes[1].IsNull);
}
#endregion
#region VB.NET
[Test]
public void SimpleTypeOfExpressionTest()
public void VBSimpleTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilVBNet.ParseExpression("GetType(MyNamespace.N1.MyType)", typeof(TypeOfExpression));
Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
}
[Test]
public void VBGlobalTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilVBNet.ParseExpression("GetType(Global.System.Console)", typeof(TypeOfExpression));
Assert.AreEqual("System.Console", toe.TypeReference.Type);
}
[Test]
public void VBPrimitiveTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilVBNet.ParseExpression("GetType(integer)", typeof(TypeOfExpression));
Assert.AreEqual("System.Int32", toe.TypeReference.SystemType);
}
[Test]
public void VBVoidTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilVBNet.ParseExpression("GetType(void)", typeof(TypeOfExpression));
Assert.AreEqual("System.Void", toe.TypeReference.SystemType);
}
[Test]
public void VBArrayTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilVBNet.ParseExpression("GetType(MyType())", typeof(TypeOfExpression));
Assert.AreEqual("MyType", toe.TypeReference.Type);
Assert.AreEqual(new int[] {0}, toe.TypeReference.RankSpecifier);
}
[Test]
public void VBGenericTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilVBNet.ParseExpression("GetType(MyNamespace.N1.MyType(Of string))", typeof(TypeOfExpression));
Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
Assert.AreEqual("System.String", toe.TypeReference.GenericTypes[0].SystemType);
}
[Test]
public void VBUnboundTypeOfExpressionTest()
{
TypeOfExpression toe = (TypeOfExpression)ParseUtilVBNet.ParseExpression("GetType(MyType(Of ,))", typeof(TypeOfExpression));
Assert.AreEqual("MyType", toe.TypeReference.Type);
Assert.IsTrue(toe.TypeReference.GenericTypes[0].IsNull);
Assert.IsTrue(toe.TypeReference.GenericTypes[1].IsNull);
}
#endregion
}
}

Loading…
Cancel
Save