Browse Source

Fixed SD2-891: Content of VB 'With' statement not converted correctly to C#

Fixed SD2-894: Abstract properties declaration not converted correctly from VB to C#
Fixed SD2-895: VB 'Not' operator is not converted correctly to C#
Fixed SD2-901: VB 'Continue' statement not converted correctly from C#
Fixed SD2-902: C# 'break' statement not converted correctly to VB

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1607 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
3df97ea2d9
  1. 7
      src/Libraries/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs
  2. 6
      src/Libraries/NRefactory/Project/Src/Output/AbstractOutputFormatter.cs
  3. 2
      src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs
  4. 2
      src/Libraries/NRefactory/Project/Src/Output/CSharp/OutputFormatter.cs
  5. 24
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  6. 7
      src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs
  7. 122
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  8. 2
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  9. 5
      src/Libraries/NRefactory/Project/Src/Parser/Visitors/VBNetConstructsConvertVisitor.cs
  10. 37
      src/Libraries/NRefactory/Test/Output/CSharp/VBToCSharpConverterTest.cs
  11. 18
      src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs
  12. 14
      src/Libraries/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs
  13. 7
      src/Libraries/NRefactory/Test/Parser/Expressions/FieldReferenceExpressionTests.cs

7
src/Libraries/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs

@ -187,11 +187,12 @@ namespace NRefactoryASTGenerator.Ast
public PropertyDeclaration(string name, TypeReference typeReference, Modifier modifier, List<AttributeSection> attributes) : this(modifier, attributes, name, null) public PropertyDeclaration(string name, TypeReference typeReference, Modifier modifier, List<AttributeSection> attributes) : this(modifier, attributes, name, null)
{ {
this.TypeReference = typeReference; this.TypeReference = typeReference;
if ((modifier & Modifier.ReadOnly) == Modifier.ReadOnly) { if ((modifier & Modifier.ReadOnly) != Modifier.ReadOnly) {
this.GetRegion = new PropertyGetRegion(null, null);
} else if ((modifier & Modifier.WriteOnly) == Modifier.WriteOnly) {
this.SetRegion = new PropertySetRegion(null, null); this.SetRegion = new PropertySetRegion(null, null);
} }
if ((modifier & Modifier.WriteOnly) != Modifier.WriteOnly) {
this.GetRegion = new PropertyGetRegion(null, null);
}
}")] }")]
class PropertyDeclaration : ParametrizedNode class PropertyDeclaration : ParametrizedNode
{ {

6
src/Libraries/NRefactory/Project/Src/Output/AbstractOutputFormatter.cs

@ -100,6 +100,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
} }
} }
public bool LastCharacterIsWhiteSpace {
get {
return text.Length == 0 || char.IsWhiteSpace(text[text.Length - 1]);
}
}
public virtual void NewLine() public virtual void NewLine()
{ {
if (DoNewLine) { if (DoNewLine) {

2
src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs

@ -1428,7 +1428,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object Visit(WithStatement withStatement, object data) public object Visit(WithStatement withStatement, object data)
{ {
withExpressionStack.Push(withStatement); withExpressionStack.Push(withStatement);
nodeTracker.TrackedVisit(withStatement.Body, data); nodeTracker.TrackedVisit(withStatement.Body, BraceStyle.EndOfLine);
withExpressionStack.Pop(); withExpressionStack.Pop();
return null; return null;
} }

2
src/Libraries/NRefactory/Project/Src/Output/CSharp/OutputFormatter.cs

@ -49,7 +49,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
{ {
switch (style) { switch (style) {
case BraceStyle.EndOfLine: case BraceStyle.EndOfLine:
if (!LastCharacterIsWhiteSpace) {
Space(); Space();
}
PrintToken(Tokens.OpenCurlyBrace); PrintToken(Tokens.OpenCurlyBrace);
NewLine(); NewLine();
++IndentationLevel; ++IndentationLevel;

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

@ -1567,6 +1567,21 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object Visit(ContinueStatement continueStatement, object data) public object Visit(ContinueStatement continueStatement, object data)
{ {
outputFormatter.PrintToken(Tokens.Continue); outputFormatter.PrintToken(Tokens.Continue);
outputFormatter.Space();
switch (continueStatement.ContinueType) {
case ContinueType.Do:
outputFormatter.PrintToken(Tokens.Do);
break;
case ContinueType.For:
outputFormatter.PrintToken(Tokens.For);
break;
case ContinueType.While:
outputFormatter.PrintToken(Tokens.While);
break;
default:
outputFormatter.PrintToken(exitTokenStack.Peek());
break;
}
return null; return null;
} }
@ -1583,7 +1598,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object Visit(DoLoopStatement doLoopStatement, object data) public object Visit(DoLoopStatement doLoopStatement, object data)
{ {
exitTokenStack.Push(Tokens.Do);
if (doLoopStatement.ConditionPosition == ConditionPosition.None) { if (doLoopStatement.ConditionPosition == ConditionPosition.None) {
errors.Error(-1, -1, String.Format("Unknown condition position for loop : {0}.", doLoopStatement)); errors.Error(-1, -1, String.Format("Unknown condition position for loop : {0}.", doLoopStatement));
} }
@ -1591,22 +1605,28 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
if (doLoopStatement.ConditionPosition == ConditionPosition.Start) { if (doLoopStatement.ConditionPosition == ConditionPosition.Start) {
switch (doLoopStatement.ConditionType) { switch (doLoopStatement.ConditionType) {
case ConditionType.DoWhile: case ConditionType.DoWhile:
exitTokenStack.Push(Tokens.Do);
outputFormatter.PrintToken(Tokens.Do); outputFormatter.PrintToken(Tokens.Do);
outputFormatter.Space(); outputFormatter.Space();
outputFormatter.PrintToken(Tokens.While); outputFormatter.PrintToken(Tokens.While);
break; break;
case ConditionType.While: case ConditionType.While:
exitTokenStack.Push(Tokens.While);
outputFormatter.PrintToken(Tokens.While); outputFormatter.PrintToken(Tokens.While);
break; break;
case ConditionType.Until: case ConditionType.Until:
exitTokenStack.Push(Tokens.Do);
outputFormatter.PrintToken(Tokens.Do); outputFormatter.PrintToken(Tokens.Do);
outputFormatter.Space(); outputFormatter.Space();
outputFormatter.PrintToken(Tokens.While); outputFormatter.PrintToken(Tokens.While);
break; break;
default:
throw new InvalidOperationException();
} }
outputFormatter.Space(); outputFormatter.Space();
nodeTracker.TrackedVisit(doLoopStatement.Condition, null); nodeTracker.TrackedVisit(doLoopStatement.Condition, null);
} else { } else {
exitTokenStack.Push(Tokens.Do);
outputFormatter.PrintToken(Tokens.Do); outputFormatter.PrintToken(Tokens.Do);
} }
@ -1629,11 +1649,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
case ConditionType.While: case ConditionType.While:
case ConditionType.DoWhile: case ConditionType.DoWhile:
outputFormatter.PrintToken(Tokens.While); outputFormatter.PrintToken(Tokens.While);
outputFormatter.Space();
break; break;
case ConditionType.Until: case ConditionType.Until:
outputFormatter.PrintToken(Tokens.Until); outputFormatter.PrintToken(Tokens.Until);
outputFormatter.Space();
break; break;
} }
outputFormatter.Space(); outputFormatter.Space();

7
src/Libraries/NRefactory/Project/Src/Parser/AST/Generated.cs

@ -3182,11 +3182,12 @@ namespace ICSharpCode.NRefactory.Parser.Ast {
public PropertyDeclaration(string name, TypeReference typeReference, Modifier modifier, List<AttributeSection> attributes) : this(modifier, attributes, name, null) public PropertyDeclaration(string name, TypeReference typeReference, Modifier modifier, List<AttributeSection> attributes) : this(modifier, attributes, name, null)
{ {
this.TypeReference = typeReference; this.TypeReference = typeReference;
if ((modifier & Modifier.ReadOnly) == Modifier.ReadOnly) { if ((modifier & Modifier.ReadOnly) != Modifier.ReadOnly) {
this.GetRegion = new PropertyGetRegion(null, null);
} else if ((modifier & Modifier.WriteOnly) == Modifier.WriteOnly) {
this.SetRegion = new PropertySetRegion(null, null); this.SetRegion = new PropertySetRegion(null, null);
} }
if ((modifier & Modifier.WriteOnly) != Modifier.WriteOnly) {
this.GetRegion = new PropertyGetRegion(null, null);
}
} }
public bool HasSetRegion { public bool HasSetRegion {

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

@ -3539,22 +3539,20 @@ out expr);
pexpr = new IdentifierExpression(t.val); pexpr = new IdentifierExpression(t.val);
break; break;
} }
case 10: case 52: case 54: case 65: case 76: case 77: case 84: case 111: case 117: case 133: case 159: case 160: case 165: case 190: case 191: case 192: case 193: { case 52: case 54: case 65: case 76: case 77: case 84: case 111: case 117: case 133: case 159: case 160: case 165: case 190: case 191: case 192: case 193: {
#line 1566 "VBNET.ATG" #line 1566 "VBNET.ATG"
string val = String.Empty; string val = String.Empty;
if (StartOf(29)) {
if (StartOf(9)) { if (StartOf(9)) {
PrimitiveTypeName( PrimitiveTypeName(
#line 1567 "VBNET.ATG" #line 1567 "VBNET.ATG"
out val); out val);
} else { } else if (la.kind == 133) {
lexer.NextToken(); lexer.NextToken();
#line 1567 "VBNET.ATG" #line 1567 "VBNET.ATG"
val = "Object"; val = "Object";
} } else SynErr(239);
}
Expect(10); Expect(10);
#line 1568 "VBNET.ATG" #line 1568 "VBNET.ATG"
@ -3586,7 +3584,7 @@ out val);
#line 1572 "VBNET.ATG" #line 1572 "VBNET.ATG"
retExpr = new ClassReferenceExpression(); retExpr = new ClassReferenceExpression();
} else SynErr(239); } else SynErr(240);
Expect(10); Expect(10);
IdentifierOrKeyword( IdentifierOrKeyword(
#line 1574 "VBNET.ATG" #line 1574 "VBNET.ATG"
@ -3636,7 +3634,7 @@ out expr);
#line 1585 "VBNET.ATG" #line 1585 "VBNET.ATG"
castType = CastType.TryCast; castType = CastType.TryCast;
} else SynErr(240); } else SynErr(241);
Expect(24); Expect(24);
Expr( Expr(
#line 1587 "VBNET.ATG" #line 1587 "VBNET.ATG"
@ -3720,7 +3718,7 @@ out name);
#line 1598 "VBNET.ATG" #line 1598 "VBNET.ATG"
ref pexpr); ref pexpr);
} }
} else SynErr(241); } else SynErr(242);
} }
void PrimitiveTypeName( void PrimitiveTypeName(
@ -3835,7 +3833,7 @@ out string type) {
type = "SByte"; type = "SByte";
break; break;
} }
default: SynErr(242); break; default: SynErr(243); break;
} }
} }
@ -3967,7 +3965,7 @@ out TypeReference type) {
type = new TypeReference("System.String"); type = new TypeReference("System.String");
break; break;
} }
default: SynErr(243); break; default: SynErr(244); break;
} }
} }
@ -4009,7 +4007,7 @@ out name);
InvocationExpression( InvocationExpression(
#line 1606 "VBNET.ATG" #line 1606 "VBNET.ATG"
ref pexpr); ref pexpr);
} else SynErr(244); } else SynErr(245);
} }
void InvocationExpression( void InvocationExpression(
@ -4057,8 +4055,8 @@ out parameters);
#line 1628 "VBNET.ATG" #line 1628 "VBNET.ATG"
pexpr = new InvocationExpression(pexpr, parameters, typeParameters); pexpr = new InvocationExpression(pexpr, parameters, typeParameters);
} else SynErr(245); } else SynErr(246);
} else if (StartOf(30)) { } else if (StartOf(29)) {
ArgumentList( ArgumentList(
#line 1630 "VBNET.ATG" #line 1630 "VBNET.ATG"
out parameters); out parameters);
@ -4066,7 +4064,7 @@ out parameters);
#line 1632 "VBNET.ATG" #line 1632 "VBNET.ATG"
pexpr = new InvocationExpression(pexpr, parameters, typeParameters); pexpr = new InvocationExpression(pexpr, parameters, typeParameters);
} else SynErr(246); } else SynErr(247);
#line 1634 "VBNET.ATG" #line 1634 "VBNET.ATG"
pexpr.StartLocation = start; pexpr.EndLocation = t.Location; pexpr.StartLocation = start; pexpr.EndLocation = t.Location;
@ -4169,7 +4167,7 @@ out Expression outExpr) {
ShiftExpr( ShiftExpr(
#line 1706 "VBNET.ATG" #line 1706 "VBNET.ATG"
out outExpr); out outExpr);
while (StartOf(31)) { while (StartOf(30)) {
switch (la.kind) { switch (la.kind) {
case 27: { case 27: {
lexer.NextToken(); lexer.NextToken();
@ -4235,7 +4233,7 @@ out outExpr);
break; break;
} }
} }
if (StartOf(32)) { if (StartOf(31)) {
ShiftExpr( ShiftExpr(
#line 1720 "VBNET.ATG" #line 1720 "VBNET.ATG"
out expr); out expr);
@ -4250,7 +4248,7 @@ out expr);
#line 1723 "VBNET.ATG" #line 1723 "VBNET.ATG"
outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not)); outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not));
} else SynErr(247); } else SynErr(248);
} }
} }
@ -4530,7 +4528,7 @@ out expr);
Expr( Expr(
#line 1873 "VBNET.ATG" #line 1873 "VBNET.ATG"
out argumentexpr); out argumentexpr);
} else SynErr(248); } else SynErr(249);
} }
void QualIdentAndTypeArguments( void QualIdentAndTypeArguments(
@ -4566,7 +4564,7 @@ canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma))
TypeArgumentList( TypeArgumentList(
#line 1929 "VBNET.ATG" #line 1929 "VBNET.ATG"
typeref.GenericTypes); typeref.GenericTypes);
} else SynErr(249); } else SynErr(250);
Expect(25); Expect(25);
} }
} }
@ -4691,7 +4689,7 @@ out name);
#line 2042 "VBNET.ATG" #line 2042 "VBNET.ATG"
if (nameFound) Error("no positional argument after named argument"); if (nameFound) Error("no positional argument after named argument");
} else SynErr(250); } else SynErr(251);
Expr( Expr(
#line 2043 "VBNET.ATG" #line 2043 "VBNET.ATG"
out expr); out expr);
@ -4716,7 +4714,7 @@ out ParameterDeclarationExpression p) {
Expression expr = null; Expression expr = null;
p = null;ArrayList arrayModifiers = null; p = null;ArrayList arrayModifiers = null;
while (StartOf(33)) { while (StartOf(32)) {
ParameterModifier( ParameterModifier(
#line 2119 "VBNET.ATG" #line 2119 "VBNET.ATG"
mod); mod);
@ -4788,7 +4786,7 @@ ParamModifiers m) {
#line 2773 "VBNET.ATG" #line 2773 "VBNET.ATG"
m.Add(ParamModifier.Params); m.Add(ParamModifier.Params);
} else SynErr(251); } else SynErr(252);
} }
void Statement() { void Statement() {
@ -4812,21 +4810,21 @@ out label);
Expect(13); Expect(13);
Statement(); Statement();
} else if (StartOf(34)) { } else if (StartOf(33)) {
EmbeddedStatement( EmbeddedStatement(
#line 2176 "VBNET.ATG" #line 2176 "VBNET.ATG"
out stmt); out stmt);
#line 2176 "VBNET.ATG" #line 2176 "VBNET.ATG"
compilationUnit.AddChild(stmt); compilationUnit.AddChild(stmt);
} else if (StartOf(35)) { } else if (StartOf(34)) {
LocalDeclarationStatement( LocalDeclarationStatement(
#line 2177 "VBNET.ATG" #line 2177 "VBNET.ATG"
out stmt); out stmt);
#line 2177 "VBNET.ATG" #line 2177 "VBNET.ATG"
compilationUnit.AddChild(stmt); compilationUnit.AddChild(stmt);
} else SynErr(252); } else SynErr(253);
#line 2180 "VBNET.ATG" #line 2180 "VBNET.ATG"
if (stmt != null) { if (stmt != null) {
@ -4853,7 +4851,7 @@ out string name) {
#line 2561 "VBNET.ATG" #line 2561 "VBNET.ATG"
name = t.val; name = t.val;
} else SynErr(253); } else SynErr(254);
} }
void EmbeddedStatement( void EmbeddedStatement(
@ -4930,7 +4928,7 @@ out Statement statement) {
exitType = ExitType.Select; exitType = ExitType.Select;
break; break;
} }
default: SynErr(254); break; default: SynErr(255); break;
} }
#line 2245 "VBNET.ATG" #line 2245 "VBNET.ATG"
@ -5019,7 +5017,7 @@ out embeddedStatement);
name = t.val; name = t.val;
if (la.kind == 24) { if (la.kind == 24) {
lexer.NextToken(); lexer.NextToken();
if (StartOf(30)) { if (StartOf(29)) {
ArgumentList( ArgumentList(
#line 2257 "VBNET.ATG" #line 2257 "VBNET.ATG"
out p); out p);
@ -5133,7 +5131,7 @@ out expr);
#line 2299 "VBNET.ATG" #line 2299 "VBNET.ATG"
statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End); statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End);
} else SynErr(255); } else SynErr(256);
break; break;
} }
case 98: { case 98: {
@ -5226,7 +5224,7 @@ out nextExpr);
#line 2341 "VBNET.ATG" #line 2341 "VBNET.ATG"
statement = new ForNextStatement(typeReference, typeName, start, end, step, embeddedStatement, nextExpressions); statement = new ForNextStatement(typeReference, typeName, start, end, step, embeddedStatement, nextExpressions);
} else SynErr(256); } else SynErr(257);
break; break;
} }
case 92: { case 92: {
@ -5377,7 +5375,7 @@ out embeddedStatement);
#line 2401 "VBNET.ATG" #line 2401 "VBNET.ATG"
statement = ifStatement; statement = ifStatement;
} else if (StartOf(34)) { } else if (StartOf(33)) {
EmbeddedStatement( EmbeddedStatement(
#line 2404 "VBNET.ATG" #line 2404 "VBNET.ATG"
out embeddedStatement); out embeddedStatement);
@ -5396,7 +5394,7 @@ out embeddedStatement);
} }
if (la.kind == 86) { if (la.kind == 86) {
lexer.NextToken(); lexer.NextToken();
if (StartOf(34)) { if (StartOf(33)) {
EmbeddedStatement( EmbeddedStatement(
#line 2410 "VBNET.ATG" #line 2410 "VBNET.ATG"
out embeddedStatement); out embeddedStatement);
@ -5418,7 +5416,7 @@ out embeddedStatement);
#line 2419 "VBNET.ATG" #line 2419 "VBNET.ATG"
statement = ifStatement; statement = ifStatement;
} else SynErr(257); } else SynErr(258);
break; break;
} }
case 155: { case 155: {
@ -5517,7 +5515,7 @@ out resumeStatement);
SimpleExpr( SimpleExpr(
#line 2454 "VBNET.ATG" #line 2454 "VBNET.ATG"
out expr); out expr);
if (StartOf(36)) { if (StartOf(35)) {
AssignmentOperator( AssignmentOperator(
#line 2456 "VBNET.ATG" #line 2456 "VBNET.ATG"
out op); out op);
@ -5531,7 +5529,7 @@ out val);
#line 2457 "VBNET.ATG" #line 2457 "VBNET.ATG"
if (mustBeAssignment) Error("error in assignment."); if (mustBeAssignment) Error("error in assignment.");
} else SynErr(258); } else SynErr(259);
#line 2460 "VBNET.ATG" #line 2460 "VBNET.ATG"
// a field reference expression that stands alone is a // a field reference expression that stands alone is a
@ -5589,12 +5587,12 @@ out block);
#line 2480 "VBNET.ATG" #line 2480 "VBNET.ATG"
statement = new UsingStatement(new StatementExpression(expr), block); statement = new UsingStatement(new StatementExpression(expr), block);
} else SynErr(259); } else SynErr(260);
Expect(88); Expect(88);
Expect(188); Expect(188);
break; break;
} }
default: SynErr(260); break; default: SynErr(261); break;
} }
} }
@ -5736,7 +5734,7 @@ out ConditionType conditionType) {
#line 2642 "VBNET.ATG" #line 2642 "VBNET.ATG"
conditionType = ConditionType.Until; conditionType = ConditionType.Until;
} else SynErr(261); } else SynErr(262);
} }
void LoopControlVariable( void LoopControlVariable(
@ -5852,7 +5850,7 @@ out goToStatement);
#line 2538 "VBNET.ATG" #line 2538 "VBNET.ATG"
stmt = new OnErrorStatement(new ResumeStatement(true)); stmt = new OnErrorStatement(new ResumeStatement(true));
} else SynErr(262); } else SynErr(263);
} }
void GotoStatement( void GotoStatement(
@ -5890,7 +5888,7 @@ IsResumeNext()) {
resumeStatement = new ResumeStatement(true); resumeStatement = new ResumeStatement(true);
} else if (la.kind == 153) { } else if (la.kind == 153) {
lexer.NextToken(); lexer.NextToken();
if (StartOf(37)) { if (StartOf(36)) {
LabelName( LabelName(
#line 2595 "VBNET.ATG" #line 2595 "VBNET.ATG"
out label); out label);
@ -5898,7 +5896,7 @@ out label);
#line 2595 "VBNET.ATG" #line 2595 "VBNET.ATG"
resumeStatement = new ResumeStatement(label); resumeStatement = new ResumeStatement(label);
} else SynErr(263); } else SynErr(264);
} }
void CaseClause( void CaseClause(
@ -5916,7 +5914,7 @@ out CaseLabel caseClause) {
#line 2617 "VBNET.ATG" #line 2617 "VBNET.ATG"
caseClause = new CaseLabel(); caseClause = new CaseLabel();
} else if (StartOf(38)) { } else if (StartOf(37)) {
if (la.kind == 113) { if (la.kind == 113) {
lexer.NextToken(); lexer.NextToken();
} }
@ -5963,7 +5961,7 @@ out CaseLabel caseClause) {
op = BinaryOperatorType.InEquality; op = BinaryOperatorType.InEquality;
break; break;
} }
default: SynErr(264); break; default: SynErr(265); break;
} }
Expr( Expr(
#line 2628 "VBNET.ATG" #line 2628 "VBNET.ATG"
@ -5986,7 +5984,7 @@ out sexpr);
#line 2634 "VBNET.ATG" #line 2634 "VBNET.ATG"
caseClause = new CaseLabel(expr, sexpr); caseClause = new CaseLabel(expr, sexpr);
} else SynErr(265); } else SynErr(266);
} }
void CatchClauses( void CatchClauses(
@ -6285,30 +6283,31 @@ out blockStmt);
case 239: s = "invalid SimpleExpr"; break; case 239: s = "invalid SimpleExpr"; break;
case 240: s = "invalid SimpleExpr"; break; case 240: s = "invalid SimpleExpr"; break;
case 241: s = "invalid SimpleExpr"; break; case 241: s = "invalid SimpleExpr"; break;
case 242: s = "invalid PrimitiveTypeName"; break; case 242: s = "invalid SimpleExpr"; break;
case 243: s = "invalid CastTarget"; break; case 243: s = "invalid PrimitiveTypeName"; break;
case 244: s = "invalid InvocationOrMemberReferenceExpression"; break; case 244: s = "invalid CastTarget"; break;
case 245: s = "invalid InvocationExpression"; break; case 245: s = "invalid InvocationOrMemberReferenceExpression"; break;
case 246: s = "invalid InvocationExpression"; break; case 246: s = "invalid InvocationExpression"; break;
case 247: s = "invalid ComparisonExpr"; break; case 247: s = "invalid InvocationExpression"; break;
case 248: s = "invalid Argument"; break; case 248: s = "invalid ComparisonExpr"; break;
case 249: s = "invalid QualIdentAndTypeArguments"; break; case 249: s = "invalid Argument"; break;
case 250: s = "invalid AttributeArguments"; break; case 250: s = "invalid QualIdentAndTypeArguments"; break;
case 251: s = "invalid ParameterModifier"; break; case 251: s = "invalid AttributeArguments"; break;
case 252: s = "invalid Statement"; break; case 252: s = "invalid ParameterModifier"; break;
case 253: s = "invalid LabelName"; break; case 253: s = "invalid Statement"; break;
case 254: s = "invalid EmbeddedStatement"; break; case 254: s = "invalid LabelName"; break;
case 255: s = "invalid EmbeddedStatement"; break; case 255: s = "invalid EmbeddedStatement"; break;
case 256: s = "invalid EmbeddedStatement"; break; case 256: s = "invalid EmbeddedStatement"; break;
case 257: s = "invalid EmbeddedStatement"; break; case 257: s = "invalid EmbeddedStatement"; break;
case 258: s = "invalid EmbeddedStatement"; break; case 258: s = "invalid EmbeddedStatement"; break;
case 259: s = "invalid EmbeddedStatement"; break; case 259: s = "invalid EmbeddedStatement"; break;
case 260: s = "invalid EmbeddedStatement"; break; case 260: s = "invalid EmbeddedStatement"; break;
case 261: s = "invalid WhileOrUntil"; break; case 261: s = "invalid EmbeddedStatement"; break;
case 262: s = "invalid OnErrorStatement"; break; case 262: s = "invalid WhileOrUntil"; break;
case 263: s = "invalid ResumeStatement"; break; case 263: s = "invalid OnErrorStatement"; break;
case 264: s = "invalid CaseClause"; break; case 264: s = "invalid ResumeStatement"; break;
case 265: s = "invalid CaseClause"; break; case 265: s = "invalid CaseClause"; break;
case 266: s = "invalid CaseClause"; break;
default: s = "error " + errorNumber; break; default: s = "error " + errorNumber; break;
} }
@ -6349,8 +6348,7 @@ out blockStmt);
{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
{x,x,T,T, T,T,T,T, T,T,T,x, x,x,T,T, T,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x}, {x,x,T,T, T,T,T,T, T,T,T,x, x,x,T,T, T,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x},
{x,x,T,T, T,T,T,T, T,T,T,x, x,x,T,T, T,x,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x}, {x,x,T,T, T,T,T,T, T,T,T,x, x,x,T,T, T,x,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x},
{x,x,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x}, {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x},
{x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x},
{x,x,T,T, T,T,T,T, T,T,T,x, T,x,T,T, T,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x}, {x,x,T,T, T,T,T,T, T,T,T,x, T,x,T,T, T,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x},
{x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
{x,x,T,T, T,T,T,T, T,T,T,x, x,x,T,T, T,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x}, {x,x,T,T, T,T,T,T, T,T,T,x, x,x,T,T, T,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,T, x,T,T,T, T,x,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, T,T,T,T, T,T,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,T,x,T, x,x,x,x, T,T,x,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,T,x,x, x,T,x,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, x,x,x,x, T,x,x},

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

@ -1564,7 +1564,7 @@ SimpleExpr<out Expression pexpr>
| /* 11.4.2 */ "(" Expr<out expr> ")" (. pexpr = new ParenthesizedExpression(expr); .) | /* 11.4.2 */ "(" Expr<out expr> ")" (. pexpr = new ParenthesizedExpression(expr); .)
| /* 11.4.4 */ Identifier (. pexpr = new IdentifierExpression(t.val); .) | /* 11.4.4 */ Identifier (. pexpr = new IdentifierExpression(t.val); .)
| (. string val = String.Empty; .) | (. string val = String.Empty; .)
[ PrimitiveTypeName<out val> | "Object" (. val = "Object"; .) ] ( PrimitiveTypeName<out val> | "Object" (. val = "Object"; .) )
"." (. t.val = ""; .) Identifier (. pexpr = new FieldReferenceExpression(new TypeReferenceExpression(val), t.val); .) "." (. t.val = ""; .) Identifier (. pexpr = new FieldReferenceExpression(new TypeReferenceExpression(val), t.val); .)
| "Me" (. pexpr = new ThisReferenceExpression(); .) | "Me" (. pexpr = new ThisReferenceExpression(); .)
| (. Expression retExpr = null; .) | (. Expression retExpr = null; .)

5
src/Libraries/NRefactory/Project/Src/Parser/Visitors/VBNetConstructsConvertVisitor.cs

@ -383,6 +383,9 @@ namespace ICSharpCode.NRefactory.Parser
{ {
base.Visit(unaryOperatorExpression, data); base.Visit(unaryOperatorExpression, data);
if (unaryOperatorExpression.Op == UnaryOperatorType.Not) { if (unaryOperatorExpression.Op == UnaryOperatorType.Not) {
if (unaryOperatorExpression.Expression is BinaryOperatorExpression) {
unaryOperatorExpression.Expression = new ParenthesizedExpression(unaryOperatorExpression.Expression);
}
ParenthesizedExpression pe = unaryOperatorExpression.Expression as ParenthesizedExpression; ParenthesizedExpression pe = unaryOperatorExpression.Expression as ParenthesizedExpression;
if (pe != null) { if (pe != null) {
BinaryOperatorExpression boe = pe.Expression as BinaryOperatorExpression; BinaryOperatorExpression boe = pe.Expression as BinaryOperatorExpression;
@ -390,8 +393,6 @@ namespace ICSharpCode.NRefactory.Parser
boe.Op = BinaryOperatorType.ReferenceInequality; boe.Op = BinaryOperatorType.ReferenceInequality;
ReplaceCurrentNode(pe); ReplaceCurrentNode(pe);
} }
} else if (unaryOperatorExpression.Expression is BinaryOperatorExpression) {
unaryOperatorExpression.Expression = new ParenthesizedExpression(unaryOperatorExpression.Expression);
} }
} }
return null; return null;

37
src/Libraries/NRefactory/Test/Output/CSharp/VBToCSharpConverterTest.cs

@ -160,6 +160,27 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"public object A {\n\tset {\n\t\tobject x = value;\n\t}\n}"); "public object A {\n\tset {\n\t\tobject x = value;\n\t}\n}");
} }
[Test]
public void AbstractProperty1()
{
TestMember("Public MustOverride Property Salary() As Decimal",
"public abstract decimal Salary {\n\tget;\n\tset;\n}");
}
[Test]
public void AbstractProperty2()
{
TestMember("Public ReadOnly MustOverride Property Salary() As Decimal",
"public abstract decimal Salary {\n\tget;\n}");
}
[Test]
public void AbstractProperty3()
{
TestMember("Public WriteOnly MustOverride Property Salary() As Decimal",
"public abstract decimal Salary {\n\tset;\n}");
}
[Test] [Test]
public void FieldDeclaredWithDim() public void FieldDeclaredWithDim()
{ {
@ -430,6 +451,13 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestStatement("a = Not b = c", "a = !(b == c);"); TestStatement("a = Not b = c", "a = !(b == c);");
} }
[Test]
public void NotIsNothing()
{
TestStatement("a = Not fs Is Nothing",
"a = (fs != null);");
}
[Test] [Test]
public void StaticMethodVariable() public void StaticMethodVariable()
{ {
@ -473,5 +501,14 @@ static int static_Test2_j = 0;");
TestStatement("Using sw\nEnd Using", TestStatement("Using sw\nEnd Using",
"using (sw) {\n}"); "using (sw) {\n}");
} }
[Test]
public void WithStatementTest()
{
TestStatement("With Ejes\n" +
"\t.AddLine(p1, p2)\n" +
"End With",
"{\n\tEjes.AddLine(p1, p2);\n}");
}
} }
} }

18
src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs

@ -351,5 +351,23 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{ {
TestStatement("uint s = 0;", "Dim s As UInteger = 0"); TestStatement("uint s = 0;", "Dim s As UInteger = 0");
} }
[Test]
public void BreakInWhileLoop()
{
TestStatement("while (test != null) { break; }",
"While test IsNot Nothing\n" +
"\tExit While\n" +
"End While");
}
[Test]
public void BreakInDoLoop()
{
TestStatement("do { break; } while (test != null);",
"Do\n" +
"\tExit Do\n" +
"Loop While test IsNot Nothing");
}
} }
} }

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

@ -359,5 +359,19 @@ End Using");
{ {
TestStatement("Using obj\nEnd Using"); TestStatement("Using obj\nEnd Using");
} }
[Test]
public void ContinueFor()
{
TestStatement("Continue For");
}
[Test]
public void WithStatement()
{
TestStatement("With Ejes\n" +
"\t.AddLine(New Point(Me.ClientSize.Width / 2, 0), (New Point(Me.ClientSize.Width / 2, Me.ClientSize.Height)))\n" +
"End With");
}
} }
} }

7
src/Libraries/NRefactory/Test/Parser/Expressions/FieldReferenceExpressionTests.cs

@ -90,6 +90,13 @@ namespace ICSharpCode.NRefactory.Tests.Ast
Assert.AreEqual("myTargetObject", ((IdentifierExpression)fre.TargetObject).Identifier); Assert.AreEqual("myTargetObject", ((IdentifierExpression)fre.TargetObject).Identifier);
} }
[Test]
public void VBNetFieldReferenceExpressionWithoutTargetTest()
{
FieldReferenceExpression fre = ParseUtilVBNet.ParseExpression<FieldReferenceExpression>(".myField");
Assert.AreEqual("myField", fre.FieldName);
Assert.IsTrue(fre.TargetObject.IsNull);
}
[Test] [Test]
public void VBNetGenericFieldReferenceExpressionTest() public void VBNetGenericFieldReferenceExpressionTest()

Loading…
Cancel
Save