diff --git a/src/Libraries/NRefactory/Test/Parser/ParseUtilCSharp.cs b/src/Libraries/NRefactory/Test/Parser/ParseUtilCSharp.cs index 3d43e33e75..4fdf2db210 100644 --- a/src/Libraries/NRefactory/Test/Parser/ParseUtilCSharp.cs +++ b/src/Libraries/NRefactory/Test/Parser/ParseUtilCSharp.cs @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast Type type = typeof(T); Assert.IsTrue(type.IsAssignableFrom(parser.CompilationUnit.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parser.CompilationUnit.Children[0].GetType(), type, parser.CompilationUnit.Children[0])); parser.CompilationUnit.AcceptVisitor(new CheckParentVisitor(), null); - parser.CompilationUnit.AcceptVisitor(new LocationAssignmentCheckVisitor(), null); + parser.CompilationUnit.AcceptChildren(new LocationAssignmentCheckVisitor(), null); return (T)parser.CompilationUnit.Children[0]; } @@ -76,11 +76,12 @@ namespace ICSharpCode.NRefactory.Tests.Ast { // SEMICOLON HACK : without a trailing semicolon, parsing expressions does not work correctly IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(expr + ";")); - object parsedExpression = parser.ParseExpression(); + INode parsedExpression = parser.ParseExpression(); if (expectErrors) Assert.IsTrue(parser.Errors.ErrorOutput.Length > 0, "There were errors expected, but parser finished without errors."); else Assert.AreEqual("", parser.Errors.ErrorOutput); + parsedExpression.AcceptVisitor(new LocationAssignmentCheckVisitor(), null); Type type = typeof(T); Assert.IsTrue(type.IsAssignableFrom(parsedExpression.GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parsedExpression.GetType(), type, parsedExpression)); return (T)parsedExpression; diff --git a/src/Libraries/NRefactory/Test/Parser/ParseUtilVBNet.cs b/src/Libraries/NRefactory/Test/Parser/ParseUtilVBNet.cs index d6e4fa04c6..6cc793a448 100644 --- a/src/Libraries/NRefactory/Test/Parser/ParseUtilVBNet.cs +++ b/src/Libraries/NRefactory/Test/Parser/ParseUtilVBNet.cs @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast Assert.IsTrue(type.IsAssignableFrom(parser.CompilationUnit.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parser.CompilationUnit.Children[0].GetType(), type, parser.CompilationUnit.Children[0])); parser.CompilationUnit.AcceptVisitor(new CheckParentVisitor(), null); - parser.CompilationUnit.AcceptVisitor(new LocationAssignmentCheckVisitor(), null); + parser.CompilationUnit.AcceptChildren(new LocationAssignmentCheckVisitor(), null); return (T)parser.CompilationUnit.Children[0]; } @@ -76,11 +76,12 @@ namespace ICSharpCode.NRefactory.Tests.Ast public static T ParseExpression(string expr, bool expectErrors) where T : INode { IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(expr)); - object parsedExpression = parser.ParseExpression(); + INode parsedExpression = parser.ParseExpression(); if (expectErrors) Assert.IsFalse(parser.Errors.ErrorOutput.Length == 0, "Expected errors, but operation completed successfully"); else Assert.AreEqual("", parser.Errors.ErrorOutput); + parsedExpression.AcceptVisitor(new LocationAssignmentCheckVisitor(), null); Type type = typeof(T); Assert.IsTrue(type.IsAssignableFrom(parsedExpression.GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parsedExpression.GetType(), type, parsedExpression)); return (T)parsedExpression;