Browse Source

Fixed typeofexpression tests.

newNRvisualizers
Mike Krüger 15 years ago
parent
commit
021a9fbc70
  1. 14
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/TypeOfExpressionTests.cs
  2. 2
      ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs

14
ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/TypeOfExpressionTests.cs

@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression @@ -24,7 +24,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression
}});
}
[Test, Ignore("Aliases not yet implemented")]
[Test]
public void GlobalTypeOfExpressionTest()
{
ParseUtilCSharp.AssertExpression(
@ -108,11 +108,17 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression @@ -108,11 +108,17 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression
}});
}
[Test, Ignore("How do we represent unbound types in the AST?")]
[Test]
public void UnboundTypeOfExpressionTest()
{
TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(MyType<,>)");
throw new NotImplementedException("How do we represent unbound types in the AST?");
var type = new SimpleType("MyType");
type.AddChild (new SimpleType (), SimpleType.Roles.TypeArgument);
type.AddChild (new SimpleType (), SimpleType.Roles.TypeArgument);
ParseUtilCSharp.AssertExpression(
"typeof(MyType<,>)",
new TypeOfExpression {
Type = type
});
}
}
}

2
ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs

@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -69,7 +69,7 @@ namespace ICSharpCode.NRefactory.CSharp
void AddTypeArguments (ATypeNameExpression texpr, AstType result)
{
if (!texpr.HasTypeArguments)
if (texpr.TypeArguments == null || texpr.TypeArguments.Args == null)
return;
foreach (var arg in texpr.TypeArguments.Args) {
result.AddChild (ConvertToType (arg), AstType.Roles.TypeArgument);

Loading…
Cancel
Save