Browse Source

Squashed 'NRefactory/' changes from a92606c..56fde51

56fde51 Use "Role" suffix for the fixed field variable role.
e8d8ff8 Merge NRefactory changes from ILSpy.
d022808 Fixed parsing of enum member declarations.
f030426 Added extern alias node.
d8e26ed Added fixed field ast node. I thought about this a bit - it's a better solution to invent a new node for this construct even if it's reallly close to fields. Really close != same.
836e178 Fixed bug in formatting unit tests.
c01ba21 Converted the unit tests. Some of them are failing - I expect it has to do with the adapter.
9b1913e Track API changes.
2bee26a Added AST formatting visitor.
749f5a8 Updated parser & mcs.
605a56a merged changes related to lambdas and expression finding from old NRefactory
8c36dd8 renamed VB.Dom to VB.Ast
bf96506 DefiniteAssignmentAnalysis bugfix
4e1140d Fixed definite assignment analysis bug.
ebc34e6 Add NextStatement/PreviousStatement properties.
6f2e9c2 Order the control flow nodes lexically, and allow restricting definite assignment analysis to a specific lexical range.
3cc6fab Allow performing definite assignment analysis without providing an ITypeResolveContext.
5660677 Add InsertAfter/InsertBefore to AstNodeCollection.
ccfd4ea Evaluate constant expressions in definite assignment analysis.
3a4fdf2 Add support for non-custom attributes to CecilLoader.
f68a49b Improve spacing in fixed statement output.
9974734 Use a property to return the list of annotations.
735cb85 Fix issues in definite assignment analysis.
65bf46a Set NRefactory back to .NET 4.0 (we're not going to port ILSpy to .NET 3.5)
76dfccc Add definite assignment analysis.
a79d43d Add control flow analysis for the NRefactory C# AST.
c33f33e Enable using patterns in place of catch clauses.
3ad453d Add OptionalNode for pattern matching.
cfccfca AstNode: add Invoke() methods to AstType (builds InvocationExpression for static methods)
60b3164 NRefactory AstNode: add DescendantsAndSelf property.
c6a8a1f Add support for Modifiers.Any (for pattern-matching) and for AttributeSection patterns.
73350e7 small code reformatting
fdf1dac Indexer decompilation support.
cafda5f Generate switch default case.   Closes #26
0c9dec1 Fix output of float/double literals that are infinite or NaN.
0c9b5cb Remove "Attribute" suffix and add support for attributes on type parameters.
35d0426 Adjust ILSpy to NRefactory changes.
c997b75 Merge commit '39fcd7d72f73d386455d00d63446601c99eafb83'
bc195b8 Merge branch 'WithNUnit' of git://github.com/arturek/ILSpy
f4f554d more attribute targets implemented.
74fd14a attributed parameter declaration.
a07f545 Printing initializers of enum members.
20ceef1 Merge branch 'master' of git://github.com/icsharpcode/ILSpy into cust-attr
07c8c0c Use newlines in array initializers.
1cb5642 Merge commit '7ac091e93d8112b369425cceab64829c094e401c'
f2c8607 Print a custom attribute's positional arguments.
212d39b Fix duplicate reference to Mono.Cecil.
5dfed88 Removed redundant int base type of enum.
8bd4e5d Basic output of custom attributes attached to types and methods.
9a1d759 Modifications of solution and project files made by VS2010.

git-subtree-dir: NRefactory
git-subtree-split: 56fde51b698e6c7b8ea23ebbc5caf0cd10bc4682
pull/129/head
Daniel Grunwald 15 years ago
parent
commit
30eaac3091
  1. 24
      ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj
  2. 2
      ICSharpCode.NRefactory.Demo/VBAstView.Designer.cs
  3. 8
      ICSharpCode.NRefactory.Demo/VBAstView.cs
  4. 0
      ICSharpCode.NRefactory.Demo/VBAstView.resx
  5. 4
      ICSharpCode.NRefactory.Demo/VBDemo.Designer.cs
  6. 201
      ICSharpCode.NRefactory.Tests/CSharp/Analysis/DefiniteAssignmentTests.cs
  7. 10
      ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs
  8. 9
      ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs
  9. 2
      ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs
  10. 285
      ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs
  11. 405
      ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs
  12. 143
      ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs
  13. 1792
      ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs
  14. 1491
      ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs
  15. 512
      ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs
  16. 261
      ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs
  17. 23
      ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj
  18. 28
      ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs
  19. 101
      ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs
  20. 10
      ICSharpCode.NRefactory.VB.Tests/General/UnitTest.cs
  21. 6
      ICSharpCode.NRefactory.VB.Tests/Lexer/LexerContextTests.cs
  22. 2
      ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs
  23. 2
      ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs
  24. 2
      ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMTypeReferenceTest.cs
  25. 2
      ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/InvocationExpressionTest.cs
  26. 2
      ICSharpCode.NRefactory.VB.Tests/Output/SpecialOutputVisitorTest.cs
  27. 2
      ICSharpCode.NRefactory.VB.Tests/Output/VBNet/VBNetOutputTest.cs
  28. 6
      ICSharpCode.NRefactory.VB.Tests/Parser/CheckParentVisitor.cs
  29. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AddressOfExpressionTests.cs
  30. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ArrayCreateExpressionTests.cs
  31. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AssignmentExpressionTests.cs
  32. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BaseReferenceExpressionTests.cs
  33. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BinaryOperatorExpressionTests.cs
  34. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/CastExpressionTests.cs
  35. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ClassReferenceExpressionTests.cs
  36. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ConditionalExpressionTests.cs
  37. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/GlobalReferenceExpressionTests.cs
  38. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/IdentifierExpressionTests.cs
  39. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/InvocationExpressionTests.cs
  40. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/LambdaExpressionTests.cs
  41. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/MemberReferenceExpressionTests.cs
  42. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ObjectCreateExpressionTests.cs
  43. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ParenthesizedExpressionTest.cs
  44. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/PrimitiveExpressionTests.cs
  45. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/QueryExpressionTests.cs
  46. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ThisReferenceExpressionTests.cs
  47. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfExpressionTests.cs
  48. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfIsExpressionTests.cs
  49. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeReferenceExpressionTests.cs
  50. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/UnaryOperatorExpressionTests.cs
  51. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlExpressionTests.cs
  52. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlMemberAccessExpressionTests.cs
  53. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/AttributeSectionTests.cs
  54. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/DelegateDeclarationTests.cs
  55. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/NamespaceDeclarationTests.cs
  56. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/OptionDeclarationTests.cs
  57. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/TypeDeclarationTests.cs
  58. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/UsingDeclarationTests.cs
  59. 6
      ICSharpCode.NRefactory.VB.Tests/Parser/LocationAssignmentCheckVisitor.cs
  60. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/ParseUtil.cs
  61. 2
      ICSharpCode.NRefactory.VB.Tests/Parser/SnippetParserTests.cs
  62. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/AddHandlerStatementTests.cs
  63. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/BlockStatementTests.cs
  64. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ContinueStatementTests.cs
  65. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/DoLoopStatementTests.cs
  66. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EndStatementTests.cs
  67. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EraseStatementTests.cs
  68. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ErrorStatementTests.cs
  69. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ExpressionStatementTests.cs
  70. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForNextStatementTests.cs
  71. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForeachStatementTests.cs
  72. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/GotoStatementTests.cs
  73. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/IfElseStatementTests.cs
  74. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LabelStatementTests.cs
  75. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LocalVariableDeclarationTests.cs
  76. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LockStatementTests.cs
  77. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/OnErrorStatementTest.cs
  78. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RaiseEventStatementTest.cs
  79. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReDimStatementTests.cs
  80. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RemoveHandlerStatement.cs
  81. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ResumeStatement.cs
  82. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReturnStatementTests.cs
  83. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/StopStatementTests.cs
  84. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/SwitchStatementTests.cs
  85. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ThrowStatementTests.cs
  86. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/TryCatchStatementTests.cs
  87. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/UsingStatementTests.cs
  88. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/Statements/WithStatementTests.cs
  89. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/ConstructorDeclarationTests.cs
  90. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/CustomEventTests.cs
  91. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/DeclareDeclarationTests.cs
  92. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/EventDeclarationTests.cs
  93. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/FieldDeclarationTests.cs
  94. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/MethodDeclarationTests.cs
  95. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/OperatorDeclarationTests.cs
  96. 4
      ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/PropertyDeclarationTests.cs
  97. 6
      ICSharpCode.NRefactory.VB/Ast/AbstractNode.cs
  98. 2
      ICSharpCode.NRefactory.VB/Ast/Enums.cs
  99. 8
      ICSharpCode.NRefactory.VB/Ast/General/BlockStatement.cs
  100. 4
      ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs
  101. Some files were not shown because too many files have changed in this diff Show More

24
ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj

@ -40,21 +40,29 @@ @@ -40,21 +40,29 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="VBEditDialog.cs" />
<Compile Include="VBEditDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="VBEditDialog.Designer.cs">
<DependentUpon>VBEditDialog.cs</DependentUpon>
</Compile>
<Compile Include="VBDomView.cs" />
<Compile Include="VBDomView.Designer.cs">
<DependentUpon>VBDomView.cs</DependentUpon>
<Compile Include="VBAstView.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="VBAstView.Designer.cs">
<DependentUpon>VBAstView.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.cs" />
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VBDemo.cs" />
<Compile Include="VBDemo.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="VBDemo.Designer.cs">
<DependentUpon>VBDemo.cs</DependentUpon>
</Compile>
@ -73,8 +81,8 @@ @@ -73,8 +81,8 @@
<EmbeddedResource Include="VBEditDialog.resx">
<DependentUpon>VBEditDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="VBDomView.resx">
<DependentUpon>VBDomView.cs</DependentUpon>
<EmbeddedResource Include="VBAstView.resx">
<DependentUpon>VBAstView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>

2
ICSharpCode.NRefactory.Demo/VBDomView.Designer.cs → ICSharpCode.NRefactory.Demo/VBAstView.Designer.cs generated

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
namespace ICSharpCode.NRefactory.Demo
{
partial class VBDomView : System.Windows.Forms.UserControl
partial class VBAstView : System.Windows.Forms.UserControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.

8
ICSharpCode.NRefactory.Demo/VBDomView.cs → ICSharpCode.NRefactory.Demo/VBAstView.cs

@ -6,12 +6,12 @@ using System.Collections; @@ -6,12 +6,12 @@ using System.Collections;
using System.Windows.Forms;
using System.Reflection;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB;
namespace ICSharpCode.NRefactory.Demo
{
public partial class VBDomView
public partial class VBAstView
{
CompilationUnit unit;
@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -34,7 +34,7 @@ namespace ICSharpCode.NRefactory.Demo
tree.SelectedNode = tree.Nodes[0];
}
public VBDomView()
public VBAstView()
{
InitializeComponent();
}
@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -89,7 +89,7 @@ namespace ICSharpCode.NRefactory.Demo
((ElementNode)node).Update();
}
public void ApplyTransformation(IDomVisitor visitor)
public void ApplyTransformation(IAstVisitor visitor)
{
if (tree.SelectedNode == tree.Nodes[0]) {
unit.AcceptVisitor(visitor, null);

0
ICSharpCode.NRefactory.Demo/VBDomView.resx → ICSharpCode.NRefactory.Demo/VBAstView.resx

4
ICSharpCode.NRefactory.Demo/VBDemo.Designer.cs generated

@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -35,7 +35,7 @@ namespace ICSharpCode.NRefactory.Demo
this.codeView = new System.Windows.Forms.TextBox();
this.editNodeButton = new System.Windows.Forms.Button();
this.clearSpecialsButton = new System.Windows.Forms.Button();
this.syntaxTree = new ICSharpCode.NRefactory.Demo.VBDomView();
this.syntaxTree = new ICSharpCode.NRefactory.Demo.VBAstView();
this.generateCodeButton = new System.Windows.Forms.Button();
this.parseButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@ -154,7 +154,7 @@ namespace ICSharpCode.NRefactory.Demo @@ -154,7 +154,7 @@ namespace ICSharpCode.NRefactory.Demo
}
private System.Windows.Forms.Button clearSpecialsButton;
private System.Windows.Forms.Button editNodeButton;
private ICSharpCode.NRefactory.Demo.VBDomView syntaxTree;
private ICSharpCode.NRefactory.Demo.VBAstView syntaxTree;
private System.Windows.Forms.TextBox codeView;
private System.Windows.Forms.Button generateCodeButton;
private System.Windows.Forms.Button parseButton;

201
ICSharpCode.NRefactory.Tests/CSharp/Analysis/DefiniteAssignmentTests.cs

@ -0,0 +1,201 @@ @@ -0,0 +1,201 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
using System.Linq;
using ICSharpCode.NRefactory.TypeSystem;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.CSharp.Analysis
{
[TestFixture]
public class DefiniteAssignmentTests
{
[Test]
public void TryFinally()
{
BlockStatement block = new BlockStatement {
new TryCatchStatement {
TryBlock = new BlockStatement {
new GotoStatement("LABEL"),
new AssignmentExpression(new IdentifierExpression("i"), new PrimitiveExpression(1))
},
CatchClauses = {
new CatchClause {
Body = new BlockStatement {
new AssignmentExpression(new IdentifierExpression("i"), new PrimitiveExpression(3))
}
}
},
FinallyBlock = new BlockStatement {
new AssignmentExpression(new IdentifierExpression("j"), new PrimitiveExpression(5))
}
},
new LabelStatement { Label = "LABEL" },
new EmptyStatement()
};
TryCatchStatement tryCatchStatement = (TryCatchStatement)block.Statements.First();
Statement stmt1 = tryCatchStatement.TryBlock.Statements.ElementAt(1);
Statement stmt3 = tryCatchStatement.CatchClauses.Single().Body.Statements.Single();
Statement stmt5 = tryCatchStatement.FinallyBlock.Statements.Single();
LabelStatement label = (LabelStatement)block.Statements.ElementAt(1);
DefiniteAssignmentAnalysis da = new DefiniteAssignmentAnalysis(block, CecilLoaderTests.Mscorlib);
da.Analyze("i");
Assert.AreEqual(0, da.UnassignedVariableUses.Count);
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(tryCatchStatement));
Assert.AreEqual(DefiniteAssignmentStatus.CodeUnreachable, da.GetStatusBefore(stmt1));
Assert.AreEqual(DefiniteAssignmentStatus.CodeUnreachable, da.GetStatusAfter(stmt1));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(stmt3));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(stmt3));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(stmt5));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusAfter(stmt5));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(tryCatchStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBefore(label));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusAfter(label));
da.Analyze("j");
Assert.AreEqual(0, da.UnassignedVariableUses.Count);
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(tryCatchStatement));
Assert.AreEqual(DefiniteAssignmentStatus.CodeUnreachable, da.GetStatusBefore(stmt1));
Assert.AreEqual(DefiniteAssignmentStatus.CodeUnreachable, da.GetStatusAfter(stmt1));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(stmt3));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusAfter(stmt3));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(stmt5));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(stmt5));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(tryCatchStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBefore(label));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(label));
}
[Test]
public void ConditionalAnd()
{
IfElseStatement ifStmt = new IfElseStatement {
Condition = new BinaryOperatorExpression {
Left = new BinaryOperatorExpression(new IdentifierExpression("x"), BinaryOperatorType.GreaterThan, new PrimitiveExpression(0)),
Operator = BinaryOperatorType.ConditionalAnd,
Right = new BinaryOperatorExpression {
Left = new ParenthesizedExpression {
Expression = new AssignmentExpression {
Left = new IdentifierExpression("i"),
Operator = AssignmentOperatorType.Assign,
Right = new IdentifierExpression("y")
}
},
Operator = BinaryOperatorType.GreaterThanOrEqual,
Right = new PrimitiveExpression(0)
}
},
TrueStatement = new BlockStatement(),
FalseStatement = new BlockStatement()
};
DefiniteAssignmentAnalysis da = new DefiniteAssignmentAnalysis(ifStmt, CecilLoaderTests.Mscorlib);
da.Analyze("i");
Assert.AreEqual(0, da.UnassignedVariableUses.Count);
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(ifStmt));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBefore(ifStmt.TrueStatement));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(ifStmt.FalseStatement));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusAfter(ifStmt));
}
[Test]
public void ConditionalOr()
{
IfElseStatement ifStmt = new IfElseStatement {
Condition = new BinaryOperatorExpression {
Left = new BinaryOperatorExpression(new IdentifierExpression("x"), BinaryOperatorType.GreaterThan, new PrimitiveExpression(0)),
Operator = BinaryOperatorType.ConditionalOr,
Right = new BinaryOperatorExpression {
Left = new ParenthesizedExpression {
Expression = new AssignmentExpression {
Left = new IdentifierExpression("i"),
Operator = AssignmentOperatorType.Assign,
Right = new IdentifierExpression("y")
}
},
Operator = BinaryOperatorType.GreaterThanOrEqual,
Right = new PrimitiveExpression(0)
}
},
TrueStatement = new BlockStatement(),
FalseStatement = new BlockStatement()
};
DefiniteAssignmentAnalysis da = new DefiniteAssignmentAnalysis(ifStmt, CecilLoaderTests.Mscorlib);
da.Analyze("i");
Assert.AreEqual(0, da.UnassignedVariableUses.Count);
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(ifStmt));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(ifStmt.TrueStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBefore(ifStmt.FalseStatement));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusAfter(ifStmt));
}
[Test]
public void WhileTrue()
{
WhileStatement loop = new WhileStatement {
Condition = new PrimitiveExpression(true),
EmbeddedStatement = new BlockStatement {
new AssignmentExpression(new IdentifierExpression("i"), new PrimitiveExpression(0)),
new BreakStatement()
}
};
DefiniteAssignmentAnalysis da = new DefiniteAssignmentAnalysis(loop, CecilLoaderTests.Mscorlib);
da.Analyze("i");
Assert.AreEqual(0, da.UnassignedVariableUses.Count);
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(loop));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(loop.EmbeddedStatement));
Assert.AreEqual(DefiniteAssignmentStatus.CodeUnreachable, da.GetStatusAfter(loop.EmbeddedStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(loop));
}
[Test]
public void ForLoop()
{
ForStatement loop = new ForStatement {
Initializers = {
new ExpressionStatement(
new AssignmentExpression(new IdentifierExpression("i"), new PrimitiveExpression(0))
)
},
Condition = new BinaryOperatorExpression(new IdentifierExpression("i"), BinaryOperatorType.LessThan, new PrimitiveExpression(1000)),
Iterators = {
new ExpressionStatement(
new AssignmentExpression {
Left = new IdentifierExpression("i"),
Operator = AssignmentOperatorType.Add,
Right = new IdentifierExpression("j")
}
)
},
EmbeddedStatement = new ExpressionStatement(
new AssignmentExpression(new IdentifierExpression("j"), new IdentifierExpression("i"))
)};
DefiniteAssignmentAnalysis da = new DefiniteAssignmentAnalysis(loop, CecilLoaderTests.Mscorlib);
da.Analyze("i");
Assert.AreEqual(0, da.UnassignedVariableUses.Count);
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(loop));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(loop.Initializers.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(loop.Initializers.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBeforeLoopCondition(loop));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBefore(loop.EmbeddedStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(loop.EmbeddedStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBefore(loop.Iterators.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(loop.Iterators.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(loop));
da.Analyze("j");
Assert.AreEqual(0, da.UnassignedVariableUses.Count);
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(loop));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(loop.Initializers.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusAfter(loop.Initializers.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBeforeLoopCondition(loop));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusBefore(loop.EmbeddedStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(loop.EmbeddedStatement));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusBefore(loop.Iterators.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.DefinitelyAssigned, da.GetStatusAfter(loop.Iterators.Single()));
Assert.AreEqual(DefiniteAssignmentStatus.PotentiallyAssigned, da.GetStatusAfter(loop));
}
}
}

10
ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
@ -146,10 +146,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -146,10 +146,10 @@ namespace ICSharpCode.NRefactory.CSharp
Assert.AreEqual("a is int? ? b : c", InsertRequired(expr));
Assert.AreEqual("(a is int?) ? b : c", InsertReadable(expr));
policy.ConditionalOperatorBeforeConditionSpace = false;
policy.ConditionalOperatorAfterConditionSpace = false;
policy.ConditionalOperatorBeforeSeparatorSpace = false;
policy.ConditionalOperatorAfterSeparatorSpace = false;
policy.SpaceBeforeConditionalOperatorCondition = false;
policy.SpaceAfterConditionalOperatorCondition = false;
policy.SpaceBeforeConditionalOperatorSeparator = false;
policy.SpaceAfterConditionalOperatorSeparator = false;
Assert.AreEqual("a is int? ?b:c", InsertRequired(expr));
Assert.AreEqual("(a is int?)?b:c", InsertReadable(expr));

9
ICSharpCode.NRefactory.Tests/CSharp/Parser/GeneralScope/TypeDeclarationTests.cs

@ -272,5 +272,14 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2 @@ -272,5 +272,14 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
Assert.AreEqual("N", ns.Name);
Assert.AreEqual("MyClass", ((TypeDeclaration)ns.Members.Single()).Name);
}
[Test]
public void EnumWithInitializer()
{
TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("enum MyEnum { Val1 = 10 }");
EnumMemberDeclaration member = (EnumMemberDeclaration)td.Members.Single();
Assert.AreEqual("Val1", member.Name);
Assert.AreEqual(10, ((PrimitiveExpression)member.Initializer).Value);
}
}
}

2
ICSharpCode.NRefactory.Tests/CSharp/Resolver/ResolverTestBase.cs

@ -171,7 +171,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver @@ -171,7 +171,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
protected T Resolve<T>(string code) where T : ResolveResult
{
ResolveResult rr = Resolve(code);
Assert.IsInstanceOf(typeof(T), rr);
Assert.IsTrue(rr is T, "Resolve should be " + typeof(T).Name + ", but was " + (rr != null ? rr.GetType().Name : "null"));
return (T)rr;
}

285
ICSharpCode.NRefactory.Tests/FormattingTests/TestBlankLineFormatting.cs

@ -0,0 +1,285 @@ @@ -0,0 +1,285 @@
//
// TastBlankLineFormatting.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.CSharp;
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestBlankLineFormatting : TestBase
{
[Test()]
public void TestBlankLinesAfterUsings ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesAfterUsings = 2;
var adapter = Test (policy, @"using System;
using System.Text;
namespace Test
{
}",
@"using System;
using System.Text;
namespace Test
{
}");
policy.BlankLinesAfterUsings = 0;
Continue (policy, adapter,
@"using System;
using System.Text;
namespace Test
{
}");
}
[Test()]
public void TestBlankLinesBeforeUsings ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesAfterUsings = 0;
policy.BlankLinesBeforeUsings = 2;
var adapter = Test (policy, @"using System;
using System.Text;
namespace Test
{
}",
@"
using System;
using System.Text;
namespace Test
{
}");
policy.BlankLinesBeforeUsings = 0;
Continue (policy, adapter,
@"using System;
using System.Text;
namespace Test
{
}");
}
[Test()]
public void TestBlankLinesBeforeFirstDeclaration ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBeforeFirstDeclaration = 2;
var adapter = Test (policy, @"namespace Test
{
class Test
{
}
}",
@"namespace Test
{
class Test
{
}
}");
policy.BlankLinesBeforeFirstDeclaration = 0;
Continue (policy, adapter,
@"namespace Test
{
class Test
{
}
}");
}
[Test()]
public void TestBlankLinesBetweenTypes ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenTypes = 1;
var adapter = Test (policy, @"namespace Test
{
class Test1
{
}
class Test2
{
}
class Test3
{
}
}",
@"namespace Test
{
class Test1
{
}
class Test2
{
}
class Test3
{
}
}");
policy.BlankLinesBetweenTypes = 0;
Continue (policy, adapter, @"namespace Test
{
class Test1
{
}
class Test2
{
}
class Test3
{
}
}");
}
[Test()]
public void TestBlankLinesBetweenFields ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenFields = 1;
var adapter = Test (policy, @"class Test
{
int a;
int b;
int c;
}",
@"class Test
{
int a;
int b;
int c;
}");
policy.BlankLinesBetweenFields = 0;
Continue (policy, adapter, @"class Test
{
int a;
int b;
int c;
}");
}
[Test()]
public void TestBlankLinesBetweenEventFields ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenEventFields = 1;
var adapter = Test (policy, @"class Test
{
public event EventHandler a;
public event EventHandler b;
public event EventHandler c;
}",
@"class Test
{
public event EventHandler a;
public event EventHandler b;
public event EventHandler c;
}");
policy.BlankLinesBetweenEventFields = 0;
Continue (policy, adapter,
@"class Test
{
public event EventHandler a;
public event EventHandler b;
public event EventHandler c;
}");
}
[Test()]
public void TestBlankLinesBetweenMembers ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.BlankLinesBetweenMembers = 1;
var adapter = Test (policy,@"class Test
{
void AMethod ()
{
}
void BMethod ()
{
}
void CMethod ()
{
}
}", @"class Test
{
void AMethod ()
{
}
void BMethod ()
{
}
void CMethod ()
{
}
}");
policy.BlankLinesBetweenMembers = 0;
Continue (policy, adapter, @"class Test
{
void AMethod ()
{
}
void BMethod ()
{
}
void CMethod ()
{
}
}");
}
}
}

405
ICSharpCode.NRefactory.Tests/FormattingTests/TestBraceStlye.cs

@ -23,245 +23,184 @@ @@ -23,245 +23,184 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/*
using System;
using System.IO;
using NUnit.Framework;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.CSharp.Parser;
using MonoDevelop.CSharp.Resolver;
using MonoDevelop.CSharp.Completion;
using Mono.TextEditor;
using MonoDevelop.CSharp.Formatting;
using ICSharpCode.NRefactory.CSharp;
namespace MonoDevelop.CSharpBinding.FormattingTests
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestBraceStyle : UnitTests.TestBase
public class TestBraceStyle : TestBase
{
[Test()]
[Ignore("currently failing because namespaces are not inserted")]
public void TestNamespaceBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"namespace A
{
namespace B {
class Test {}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace A {
var adapter = Test (policy, @"namespace A
{
namespace B {
class Test {}
}
}",
@"namespace A {
namespace B {
class Test {}
}
}", data.Document.Text);
}");
policy.NamespaceBraceStyle = BraceStyle.NextLineShifted;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace A
Continue (policy, adapter,
@"namespace A
{
namespace B
{
class Test {}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestClassBraceStlye ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.EndOfLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test {
}", data.Document.Text);
Test (policy,
@"class Test {}",
@"class Test {
}");
}
[Test()]
public void TestStructBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"struct Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.StructBraceStyle = BraceStyle.NextLine;
policy.StructBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"struct Test
Test (policy,
@"struct Test {}",
@"struct Test
{
}", data.Document.Text);
}");
}
[Test()]
public void TestInterfaceBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"interface Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.InterfaceBraceStyle = BraceStyle.NextLine;
policy.InterfaceBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"interface Test
Test (policy,
@"interface Test {}",
@"interface Test
{
}", data.Document.Text);
}");
}
[Test()]
public void TestEnumBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"enum Test {
A
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.EnumBraceStyle = BraceStyle.NextLineShifted;
policy.EnumBraceStyle = BraceStyle.NextLineShifted;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"enum Test
Test (policy, @"enum Test {
A
}",
@"enum Test
{
A
}", data.Document.Text);
}");
}
[Test()]
public void TestMethodBraceStlye ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test MyMethod() {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
Test (policy, @"class Test
{
Test MyMethod()
Test MyMethod() {}
}",
@"class Test
{
Test MyMethod ()
{
}
}", data.Document.Text);
}");
}
[Test()]
public void TestConstructorBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test() {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ConstructorBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
Test (policy, @"class Test
{
Test()
Test() {}
}",
@"class Test
{
Test ()
{
}
}", data.Document.Text);
}");
}
[Test()]
public void TestDestructorBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
~Test() {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.DestructorBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
Test (policy, @"class Test
{
~Test() {}
}",
@"class Test
{
~Test()
~Test ()
{
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
Test A {
get;
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test A
{
get;
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyGetBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyGetBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
Test A {
get {
@ -269,16 +208,8 @@ namespace B { @@ -269,16 +208,8 @@ namespace B {
}
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyGetBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test A {
get
@ -287,32 +218,26 @@ namespace B { @@ -287,32 +218,26 @@ namespace B {
}
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowPropertyGetBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test A {
get { return null; }
set { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = false;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
var adapter = Test (policy, @"class Test
{
Test A {
get { return null; }
set { ; }
}
}",
@"class Test
{
Test A {
get { return null; }
@ -320,13 +245,11 @@ namespace B { @@ -320,13 +245,11 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
policy.AllowPropertyGetBlockInline = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test A {
get {
@ -336,32 +259,25 @@ namespace B { @@ -336,32 +259,25 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowPropertySetBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
{
Test A {
get { return null; }
set { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
policy.AllowPropertyGetBlockInline = false;
policy.AllowPropertySetBlockInline = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
var adapter = Test (policy, @"class Test
{
Test A {
get { return null; }
set { ; }
}
}",
@"class Test
{
Test A {
get {
@ -369,13 +285,11 @@ namespace B { @@ -369,13 +285,11 @@ namespace B {
}
set { ; }
}
}", data.Document.Text);
}");
policy.AllowPropertySetBlockInline = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test A {
get {
@ -385,15 +299,16 @@ namespace B { @@ -385,15 +299,16 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertySetBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertySetBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
Test A {
get;
@ -401,16 +316,8 @@ namespace B { @@ -401,16 +316,8 @@ namespace B {
;
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertySetBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test A {
get;
@ -419,15 +326,18 @@ namespace B { @@ -419,15 +326,18 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestEventBraceStyle ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.EventBraceStyle = BraceStyle.NextLine;
policy.EventAddBraceStyle = BraceStyle.NextLine;
policy.EventRemoveBraceStyle = BraceStyle.NextLine;
Test (policy, @"class Test
{
public event EventHandler Handler {
add {
@ -435,18 +345,8 @@ namespace B { @@ -435,18 +345,8 @@ namespace B {
remove {
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.EventBraceStyle = BraceStyle.NextLine;
policy.EventAddBraceStyle = BraceStyle.NextLine;
policy.EventRemoveBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler Handler
{
@ -457,31 +357,24 @@ namespace B { @@ -457,31 +357,24 @@ namespace B {
{
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowEventAddBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = true;
policy.AllowEventRemoveBlockInline = false;
Test (policy, @"class Test
{
public event EventHandler Handler {
add { ; }
remove { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = true;
policy.AllowEventRemoveBlockInline = false;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler Handler {
add { ; }
@ -489,31 +382,24 @@ namespace B { @@ -489,31 +382,24 @@ namespace B {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestAllowEventRemoveBlockInline ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text = @"class Test
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = false;
policy.AllowEventRemoveBlockInline = true;
Test (policy, @"class Test
{
public event EventHandler Handler {
add { ; }
remove { ; }
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.AllowEventAddBlockInline = false;
policy.AllowEventRemoveBlockInline = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Console.WriteLine (data.Document.Text);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler Handler {
add {
@ -521,10 +407,7 @@ namespace B { @@ -521,10 +407,7 @@ namespace B {
}
remove { ; }
}
}", data.Document.Text);
}");
}
}
}*/
}

143
ICSharpCode.NRefactory.Tests/FormattingTests/TestFormattingBugs.cs

@ -23,27 +23,16 @@ @@ -23,27 +23,16 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/*
using System;
using System.IO;
using NUnit.Framework;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.CSharp.Parser;
using MonoDevelop.CSharp.Resolver;
using MonoDevelop.CSharp.Completion;
using Mono.TextEditor;
using MonoDevelop.CSharp.Formatting;
using System.Collections.Generic;
using MonoDevelop.Refactoring;
using ICSharpCode.NRefactory.CSharp;
namespace MonoDevelop.CSharpBinding.FormattingTests
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestFormattingBugs : UnitTests.TestBase
public class TestFormattingBugs : TestBase
{
/// <summary>
/// Bug 325187 - Bug in smart indent
@ -71,8 +60,7 @@ Console.WriteLine (""Bad indent"");", @@ -71,8 +60,7 @@ Console.WriteLine (""Bad indent"");",
/// Bug 415469 - return ternary in a switch is not tabbed properly
/// </summary>
[Test()]
[Ignore("currently failing because of 'string' has the wrong offset - mcs bug")]
public void TestBug415469 ()
public void TestBug415469 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
@ -111,52 +99,99 @@ using (IDisposable b = null) { @@ -111,52 +99,99 @@ using (IDisposable b = null) {
}");
}
/// <summary>
/// Bug 655635 - Auto format document doesn't indent comments as well
/// </summary>
[Test()]
public void TestBug655635 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
TestStatementFormatting (policy,
@"try {
// Comment 1
myObject.x = Run ();
} catch (InvalidOperationException e) {
Console.WriteLine (e.Message);
}", @"try {
// Comment 1
myObject.x = Run ();
} catch (InvalidOperationException e) {
Console.WriteLine (e.Message);
}");
}
static void TestStatementFormatting (CSharpFormattingPolicy policy, string input, string expectedOutput)
void TestStatementFormatting (CSharpFormattingPolicy policy, string input, string expectedOutput)
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"class Test
var result = GetResult (policy, @"class Test
{
MyType TestMethod ()
{
" + input + @"
}
}";
Console.WriteLine (data.Document.Text);
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
DomSpacingVisitor domSpacingVisitor = new DomSpacingVisitor (policy, data);
domSpacingVisitor.AutoAcceptChanges = false;
compilationUnit.AcceptVisitor (domSpacingVisitor, null);
DomIndentationVisitor domIndentationVisitor = new DomIndentationVisitor (policy, data);
domIndentationVisitor.AutoAcceptChanges = false;
compilationUnit.AcceptVisitor (domIndentationVisitor, null);
List<Change> changes = new List<Change> ();
changes.AddRange (domSpacingVisitor.Changes);
changes.AddRange (domIndentationVisitor.Changes);
RefactoringService.AcceptChanges (null, null, changes);
for (int i = 0; i < data.Document.LineCount; i++) {
LineSegment line = data.Document.GetLine (i);
if (line.EditableLength < 2)
continue;
data.Remove (line.Offset, 2);
}
string text = data.Document.GetTextBetween (data.Document.GetLine (4).Offset,
data.Document.GetLine (data.Document.LineCount - 2).Offset).Trim ();
Console.WriteLine (text);
}");
int start = result.GetLineOffset (5);
int end = result.GetLineOffset (result.LineCount - 1);
string text = result.GetTextAt (start, end - start).Trim ();
expectedOutput = expectedOutput.Replace ("\n", "\n\t\t");
Assert.AreEqual (expectedOutput, text);
}
/// <summary>
/// Bug 659675 - on-the-fly code formatting breaks @-prefixed identifiers
/// </summary>
[Test()]
public void TestBug659675 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
TestStatementFormatting (policy, "@string=@int;", "@string = @int;");
}
/// <summary>
/// Bug 670213 - Document formatter deletes valid text!
/// </summary>
[Test()]
public void TestBug670213 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test
{
Test MyMethod() // Comment
{
}
}",
@"class Test
{
Test MyMethod () { // Comment
}
}");
}
/// <summary>
/// Bug 677261 - Format Document with constructor with over-indented opening curly brace
/// </summary>
[Test()]
public void TestBug677261 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ConstructorBraceStyle = BraceStyle.EndOfLine;
Test (policy, @"class Test
{
Test ()
{
}
}",
@"class Test
{
Test () {
}
}");
}
}
}
*/

1792
ICSharpCode.NRefactory.Tests/FormattingTests/TestSpacingVisitor.cs

File diff suppressed because it is too large Load Diff

1491
ICSharpCode.NRefactory.Tests/FormattingTests/TestStatementIndentation.cs

File diff suppressed because it is too large Load Diff

512
ICSharpCode.NRefactory.Tests/FormattingTests/TestTypeLevelIndentation.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
//
// TestTypeLevelIndentation.cs
//
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
@ -23,164 +23,196 @@ @@ -23,164 +23,196 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
/*
using System;
using System.IO;
using NUnit.Framework;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.CSharp.Parser;
using MonoDevelop.CSharp.Resolver;
using MonoDevelop.CSharp.Completion;
using Mono.TextEditor;
using MonoDevelop.CSharp.Formatting;
using ICSharpCode.NRefactory.CSharp;
namespace MonoDevelop.CSharpBinding.FormattingTests
namespace ICSharpCode.NRefactory.FormattingTests
{
[TestFixture()]
public class TestTypeLevelIndentation : UnitTests.TestBase
public class TestTypeLevelIndentation : TestBase
{
[Test()]
public void TestClassIndentation ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@" class Test {}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@" class Test {}",
@"class Test {}");
}
[Test()]
public void TestClassIndentationInNamespaces ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@"namespace A { class Test {} }",
@"namespace A {
class Test {}
}");
}
[Test()]
public void TestNoIndentationInNamespaces ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.IndentNamespaceBody = false;
Test (policy,
@"namespace A { class Test {} }",
@"namespace A {
class Test {}
}");
}
[Test()]
public void TestClassIndentationInNamespacesCase2 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.NamespaceBraceStyle = BraceStyle.NextLine;
policy.ClassBraceStyle = BraceStyle.NextLine;
policy.ConstructorBraceStyle = BraceStyle.NextLine;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test {}", data.Document.Text);
Test (policy,
@"using System;
namespace MonoDevelop.CSharp.Formatting {
public class FormattingProfileService {
public FormattingProfileService () {
}
}
}",
@"using System;
namespace MonoDevelop.CSharp.Formatting
{
public class FormattingProfileService
{
public FormattingProfileService ()
{
}
}
}");
}
[Test()]
public void TestIndentClassBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentClassBody = true;
Test (policy,
@"class Test
{
Test a;
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentClassBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}", @"class Test
{
Test a;
}", data.Document.Text);
}");
policy.IndentClassBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Test (policy,
@"class Test
{
Test a;
}",
@"class Test
{
Test a;
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentInterfaceBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"interface Test
{
Test Foo ();
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentInterfaceBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"interface Test
Test (policy,
@"interface Test
{
Test Foo ();
}", @"interface Test
{
Test Foo ();
}", data.Document.Text);
}");
policy.IndentInterfaceBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"interface Test
Test (policy,
@"interface Test
{
Test Foo ();
}", @"interface Test
{
Test Foo ();
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentStructBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"struct Test
{
Test a;
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentStructBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"struct Test
Test (policy,
@"struct Test
{
Test a;
}", data.Document.Text);
Test Foo ();
}", @"struct Test
{
Test Foo ();
}");
policy.IndentStructBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"struct Test
Test (policy,
@"struct Test
{
Test a;
}", data.Document.Text);
Test Foo ();
}", @"struct Test
{
Test Foo ();
}");
}
[Test()]
public void TestIndentEnumBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@"enum Test
{
A
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentEnumBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"enum Test
Test (policy,
@"enum Test
{
A
}", @"enum Test
{
A
}", data.Document.Text);
}");
policy.IndentEnumBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"enum Test
Test (policy,
@"enum Test
{
A
}", @"enum Test
{
A
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentMethodBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
Test (policy,
@"class Test
{
Test Foo ()
@ -188,40 +220,42 @@ A @@ -188,40 +220,42 @@ A
;
;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test Foo ()
{
;
;
}
}", data.Document.Text);
}");
policy.IndentMethodBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Test (policy,
@"class Test
{
Test Foo ()
{
;
;
}
}",
@"class Test
{
Test Foo ()
{
;
;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentMethodBodyOperatorCase ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
var adapter = Test (policy,
@"class Test
{
static Test operator+(Test left, Test right)
@ -229,78 +263,104 @@ A @@ -229,78 +263,104 @@ A
;
;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentMethodBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
static Test operator+(Test left, Test right)
static Test operator+ (Test left, Test right)
{
;
;
}
}", data.Document.Text);
}");
policy.IndentMethodBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter, @"class Test
{
static Test operator+(Test left, Test right)
static Test operator+ (Test left, Test right)
{
;
;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentPropertyBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
var adapter = Test (policy,
@"class Test
{
Test TestMe {
get;
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test TestMe {
get;
set;
}
}", data.Document.Text);
}");
policy.IndentPropertyBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test TestMe {
get;
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentPropertyOneLine ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = true;
Test (policy,
@"class Test
{
Test TestMe { get;set; }
}",
@"class Test
{
Test TestMe { get; set; }
}");
}
[Test()]
public void TestIndentPropertyOneLineCase2 ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
policy.AllowPropertyGetBlockInline = true;
policy.AllowPropertySetBlockInline = true;
Test (policy,
@"class Test
{
Test TestMe { get { ; }set{;} }
}",
@"class Test
{
Test TestMe { get { ; } set { ; } }
}");
}
[Test()]
public void TestIndentPropertyBodyIndexerCase ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
var adapter = Test (policy,
@"class Test
{
Test this[int a] {
@ -311,16 +371,10 @@ set { @@ -311,16 +371,10 @@ set {
;
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentPropertyBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
Test this[int a] {
Test this [int a] {
get {
return null;
}
@ -328,13 +382,12 @@ set { @@ -328,13 +382,12 @@ set {
;
}
}
}", data.Document.Text);
}");
policy.IndentPropertyBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
Test this[int a] {
Test this [int a] {
get {
return null;
}
@ -342,117 +395,129 @@ set { @@ -342,117 +395,129 @@ set {
;
}
}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyAlignment ()
{
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyFormatting = PropertyFormatting.AllowOneLine;
var adapter = Test (policy,
@"class Test
{
Test TestMe { get; set; }
}",
@"class Test
{
Test TestMe { get; set; }
}");
policy.PropertyFormatting = PropertyFormatting.ForceNewLine;
Continue (policy, adapter,
@"class Test
{
Test TestMe {
get;
set;
}
}");
policy.PropertyFormatting = PropertyFormatting.ForceOneLine;
Continue (policy, adapter,
@"class Test
{
Test TestMe { get; set; }
}");
}
[Test()]
[Ignore("currently failing because namespaces are not inserted")]
public void TestIndentNamespaceBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
@" namespace Test {
class FooBar {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.ClassBraceStyle = BraceStyle.DoNotChange;
policy.NamespaceBraceStyle = BraceStyle.EndOfLine;
policy.IndentNamespaceBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace Test {
var adapter = Test (policy,
@" namespace Test {
class FooBar {}
}",
@"namespace Test {
class FooBar {}
}", data.Document.Text);
}");
policy.IndentNamespaceBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"namespace Test {
Continue (policy, adapter,
@"namespace Test {
class FooBar {}
}", data.Document.Text);
}");
}
[Test()]
public void TestMethodIndentation ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@"class Test
{
MyType TestMethod () {}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.MethodBraceStyle = BraceStyle.DoNotChange;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
MyType TestMethod () {}
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyIndentation ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
Test (policy,
@"class Test
{
public int Prop { get; set; }
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.PropertyBraceStyle = BraceStyle.DoNotChange;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",@"class Test
{
public int Prop { get; set; }
}", data.Document.Text);
}");
}
[Test()]
public void TestPropertyIndentationCase2 ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
Test (policy,
@"class Test
{
public int Prop {
get;
set;
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public int Prop {
get;
set;
}
}", data.Document.Text);
}");
}
[Test()]
public void TestIndentEventBody ()
{
TextEditorData data = new TextEditorData ();
data.Document.FileName = "a.cs";
data.Document.Text =
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentEventBody = true;
var adapter = Test (policy,
@"class Test
{
public event EventHandler TestMe {
@ -463,14 +528,8 @@ remove { @@ -463,14 +528,8 @@ remove {
;
}
}
}";
CSharpFormattingPolicy policy = new CSharpFormattingPolicy ();
policy.IndentEventBody = true;
CSharp.Dom.CompilationUnit compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
}",
@"class Test
{
public event EventHandler TestMe {
add {
@ -480,11 +539,10 @@ remove { @@ -480,11 +539,10 @@ remove {
;
}
}
}", data.Document.Text);
}");
policy.IndentEventBody = false;
compilationUnit = new CSharpParser ().Parse (data);
compilationUnit.AcceptVisitor (new DomIndentationVisitor (policy, data), null);
Assert.AreEqual (@"class Test
Continue (policy, adapter,
@"class Test
{
public event EventHandler TestMe {
add {
@ -494,7 +552,7 @@ remove { @@ -494,7 +552,7 @@ remove {
;
}
}
}", data.Document.Text);
}");
}
}
}*/
}

261
ICSharpCode.NRefactory.Tests/FormattingTests/TextEditorTestAdapter.cs

@ -0,0 +1,261 @@ @@ -0,0 +1,261 @@
using System;
using System.Collections.Generic;
using ICSharpCode.NRefactory.CSharp;
using System.IO;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.FormattingTests
{
/// <summary>
/// Text editor test adapter. Only implemented for testing purposes. Don't use in production code.
/// </summary>
class TextEditorTestAdapter : ITextEditorAdapter
{
string text;
public string Text {
get {
return this.text;
}
}
List<Delimiter> delimiters;
struct Delimiter
{
public readonly int Offset;
public readonly int Length;
public int EndOffset {
get { return Offset + Length; }
}
public Delimiter (int offset, int length)
{
Offset = offset;
Length = length;
}
public override string ToString ()
{
return string.Format ("[Delimiter: Offset={0}, Length={1}]", Offset, Length);
}
}
static IEnumerable<Delimiter> FindDelimiter (string text)
{
for (int i = 0; i < text.Length; i++) {
switch (text [i]) {
case '\r':
if (i + 1 < text.Length && text [i + 1] == '\n') {
yield return new Delimiter (i, 2);
i++;
} else {
yield return new Delimiter (i, 1);
}
break;
case '\n':
yield return new Delimiter (i, 1);
break;
}
}
}
public TextEditorTestAdapter (string text)
{
this.text = text;
delimiters = new List<Delimiter> (FindDelimiter (text));
}
class Segment
{
public readonly int Offset;
public readonly int Length;
public readonly int DelimiterLength;
public Segment (int offset, int length, int delimiterLength)
{
this.Offset = offset;
this.Length = length;
this.DelimiterLength = delimiterLength;
}
public override string ToString ()
{
return string.Format ("[Segment: Offset={0}, Length={1}, DelimiterLength={2}]", Offset, Length, DelimiterLength);
}
}
Segment Get (int number)
{
number--;
if (number < 0 || number - 1 >= delimiters.Count)
return null;
int startOffset = number > 0 ? delimiters [number - 1].EndOffset : 0;
int endOffset;
int delimiterLength;
if (number < delimiters.Count) {
endOffset = delimiters [number].EndOffset;
delimiterLength = delimiters [number].Length;
} else {
endOffset = text.Length;
delimiterLength = 0;
}
return new Segment (startOffset, endOffset - startOffset, delimiterLength);
}
public void ApplyChanges (List<Change> changes)
{
changes.Sort ((x, y) => x.Offset.CompareTo (y.Offset));
changes.Reverse ();
foreach (var change in changes) {
text = text.Substring (0, change.Offset) + change.InsertedText + text.Substring (change.Offset + change.RemovedChars);
}
delimiters = new List<Delimiter> (FindDelimiter (text));
}
#region ITextEditorAdapter implementation
public int LocationToOffset (int line, int col)
{
Segment seg = Get (line);
if (seg == null)
return 0;
return seg.Offset + col - 1;
}
public char GetCharAt (int offset)
{
if (offset < 0 || offset >= text.Length)
return '\0';
return text [offset];
}
public string GetTextAt (int offset, int length)
{
if (offset < 0 || offset + length >= text.Length)
return "";
if (length <= 0)
return "";
return text.Substring (offset, length);
}
public int GetEditableLength (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Length - seg.DelimiterLength;
}
public string GetIndentation (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return "";
int start = seg.Offset;
int end = seg.Offset;
int endOffset = seg.Offset + seg.Length - seg.DelimiterLength;
while (end < endOffset && (text[end] == ' ' || text[end] == '\t'))
end++;
return start < end ? text.Substring (start, end - start) : "";
}
public int GetLineOffset (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Offset;
}
public int GetLineLength (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Length;
}
public int GetLineEndOffset (int lineNumber)
{
var seg = Get (lineNumber);
if (seg == null)
return 0;
return seg.Offset + seg.Length;
}
public bool TabsToSpaces {
get {
return false;
}
}
public int TabSize {
get {
return 4;
}
}
public string EolMarker {
get {
return Environment.NewLine;
}
}
public int Length {
get {
return text.Length;
}
}
public int LineCount {
get {
return delimiters.Count + 1;
}
}
#endregion
}
public abstract class TestBase
{
protected static ITextEditorAdapter GetResult (CSharpFormattingPolicy policy, string input)
{
var adapter = new TextEditorTestAdapter (input);
var visitior = new AstFormattingVisitor (policy, adapter);
var compilationUnit = new CSharpParser ().Parse (new StringReader (adapter.Text));
compilationUnit.AcceptVisitor (visitior, null);
adapter.ApplyChanges (visitior.Changes);
return adapter;
}
protected static ITextEditorAdapter Test (CSharpFormattingPolicy policy, string input, string expectedOutput)
{
var adapter = new TextEditorTestAdapter (input);
var visitior = new AstFormattingVisitor (policy, adapter);
var compilationUnit = new CSharpParser ().Parse (new StringReader (adapter.Text));
compilationUnit.AcceptVisitor (visitior, null);
adapter.ApplyChanges (visitior.Changes);
Assert.AreEqual (expectedOutput, adapter.Text);
return adapter;
}
protected static void Continue (CSharpFormattingPolicy policy, ITextEditorAdapter adapter, string expectedOutput)
{
var visitior = new AstFormattingVisitor (policy, adapter);
var compilationUnit = new CSharpParser ().Parse (new StringReader (adapter.Text));
compilationUnit.AcceptVisitor (visitior, null);
((TextEditorTestAdapter)adapter).ApplyChanges (visitior.Changes);
Assert.AreEqual (expectedOutput, adapter.Text);
}
}
}

23
ICSharpCode.NRefactory.Tests/ICSharpCode.NRefactory.Tests.csproj

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{63D3B27A-D966-4902-90B3-30290E1692F1}</ProjectGuid>
@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
@ -33,23 +32,17 @@ @@ -33,23 +32,17 @@
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="nunit.framework">
<HintPath>..\lib\nunit.framework.dll</HintPath>
<HintPath>..\..\Mono.Cecil\Test\libs\nunit-2.4.8\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
@ -59,6 +52,7 @@ @@ -59,6 +52,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CSharp\Analysis\DefiniteAssignmentTests.cs" />
<Compile Include="CSharp\AstStructureTests.cs" />
<Compile Include="CSharp\InsertParenthesesVisitorTests.cs" />
<Compile Include="CSharp\Parser\GeneralScope\DelegateDeclarationTests.cs" />
@ -154,6 +148,8 @@ @@ -154,6 +148,8 @@
<Compile Include="Untested.cs" />
<Compile Include="Utils\CSharpPrimitiveCastTests.cs" />
<Compile Include="Utils\TreeTraversalTests.cs" />
<Compile Include="FormattingTests\TextEditorTestAdapter.cs" />
<Compile Include="FormattingTests\TestBlankLineFormatting.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
@ -162,10 +158,11 @@ @@ -162,10 +158,11 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="CSharp\Parser\Expression" />
<Folder Include="CSharp\Parser\GeneralScope" />
<Folder Include="CSharp\Parser\TypeMembers" />
<Folder Include="CSharp\Parser\Statements" />
<Folder Include="CSharp\" />
<Folder Include="CSharp\Parser\" />
<Folder Include="CSharp\Parser\" />
<Folder Include="CSharp\Parser\" />
<Folder Include="CSharp\Parser\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

28
ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.TestCase.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
[assembly: ICSharpCode.NRefactory.TypeSystem.TestCase.TypeTestAttribute(
42, typeof(System.Action<>), typeof(IDictionary<string, IList<NUnit.Framework.TestAttribute>>))]
@ -65,4 +66,31 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase @@ -65,4 +66,31 @@ namespace ICSharpCode.NRefactory.TypeSystem.TestCase
{
public MyStructWithCtor(int a) {}
}
[Serializable]
public class NonCustomAttributes
{
[NonSerialized]
public readonly int NonSerializedField;
[DllImport("unmanaged.dll", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DllMethod([In, Out] ref int p);
}
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8)]
public struct ExplicitFieldLayoutStruct
{
[FieldOffset(0)]
public int Field0;
[FieldOffset(100)]
public int Field100;
}
public class ParameterTests
{
public void MethodWithOutParameter(out int x) { x = 0; }
public void MethodWithParamsArray(params object[] x) {}
}
}

101
ICSharpCode.NRefactory.Tests/TypeSystem/TypeSystemTests.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using ICSharpCode.NRefactory.TypeSystem.Implementation;
using ICSharpCode.NRefactory.TypeSystem.TestCase;
using NUnit.Framework;
@ -261,5 +262,105 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -261,5 +262,105 @@ namespace ICSharpCode.NRefactory.TypeSystem
Assert.AreEqual(2, ctors.Count());
Assert.IsFalse(ctors.Any(c => c.IsStatic));
}
[Test]
public void SerializableAttribute()
{
IAttribute attr = ctx.GetClass(typeof(NonCustomAttributes)).Attributes.Single();
Assert.AreEqual("System.SerializableAttribute", attr.AttributeType.Resolve(ctx).FullName);
}
[Test]
public void NonSerializedAttribute()
{
IField field = ctx.GetClass(typeof(NonCustomAttributes)).Fields.Single(f => f.Name == "NonSerializedField");
Assert.AreEqual("System.NonSerializedAttribute", field.Attributes.Single().AttributeType.Resolve(ctx).FullName);
}
[Test]
public void ExplicitStructLayoutAttribute()
{
IAttribute attr = ctx.GetClass(typeof(ExplicitFieldLayoutStruct)).Attributes.Single();
Assert.AreEqual("System.Runtime.InteropServices.StructLayoutAttribute", attr.AttributeType.Resolve(ctx).FullName);
IConstantValue arg1 = attr.PositionalArguments.Single();
Assert.AreEqual("System.Runtime.InteropServices.LayoutKind", arg1.GetValueType(ctx).FullName);
Assert.AreEqual((int)LayoutKind.Explicit, arg1.GetValue(ctx));
var arg2 = attr.NamedArguments[0];
Assert.AreEqual("CharSet", arg2.Key);
Assert.AreEqual("System.Runtime.InteropServices.CharSet", arg2.Value.GetValueType(ctx).FullName);
Assert.AreEqual((int)CharSet.Unicode, arg2.Value.GetValue(ctx));
var arg3 = attr.NamedArguments[1];
Assert.AreEqual("Pack", arg3.Key);
Assert.AreEqual("System.Int32", arg3.Value.GetValueType(ctx).FullName);
Assert.AreEqual(8, arg3.Value.GetValue(ctx));
}
[Test]
public void FieldOffsetAttribute()
{
IField field = ctx.GetClass(typeof(ExplicitFieldLayoutStruct)).Fields.Single(f => f.Name == "Field0");
Assert.AreEqual("System.Runtime.InteropServices.FieldOffsetAttribute", field.Attributes.Single().AttributeType.Resolve(ctx).FullName);
IConstantValue arg = field.Attributes.Single().PositionalArguments.Single();
Assert.AreEqual("System.Int32", arg.GetValueType(ctx).FullName);
Assert.AreEqual(0, arg.GetValue(ctx));
field = ctx.GetClass(typeof(ExplicitFieldLayoutStruct)).Fields.Single(f => f.Name == "Field100");
Assert.AreEqual("System.Runtime.InteropServices.FieldOffsetAttribute", field.Attributes.Single().AttributeType.Resolve(ctx).FullName);
arg = field.Attributes.Single().PositionalArguments.Single();
Assert.AreEqual("System.Int32", arg.GetValueType(ctx).FullName);
Assert.AreEqual(100, arg.GetValue(ctx));
}
[Test]
public void DllImportAttribute()
{
IMethod method = ctx.GetClass(typeof(NonCustomAttributes)).Methods.Single(m => m.Name == "DllMethod");
IAttribute dllImport = method.Attributes.Single();
Assert.AreEqual("System.Runtime.InteropServices.DllImportAttribute", dllImport.AttributeType.Resolve(ctx).FullName);
Assert.AreEqual("unmanaged.dll", dllImport.PositionalArguments[0].GetValue(ctx));
Assert.AreEqual((int)CharSet.Unicode, dllImport.NamedArguments.Single().Value.GetValue(ctx));
}
[Test]
public void InOutParametersOnRefMethod()
{
IParameter p = ctx.GetClass(typeof(NonCustomAttributes)).Methods.Single(m => m.Name == "DllMethod").Parameters.Single();
Assert.IsTrue(p.IsRef);
Assert.IsFalse(p.IsOut);
Assert.AreEqual(2, p.Attributes.Count);
Assert.AreEqual("System.Runtime.InteropServices.InAttribute", p.Attributes[0].AttributeType.Resolve(ctx).FullName);
Assert.AreEqual("System.Runtime.InteropServices.OutAttribute", p.Attributes[1].AttributeType.Resolve(ctx).FullName);
}
[Test]
public void MarshalAsAttributeOnMethod()
{
IMethod method = ctx.GetClass(typeof(NonCustomAttributes)).Methods.Single(m => m.Name == "DllMethod");
IAttribute marshalAs = method.ReturnTypeAttributes.Single();
Assert.AreEqual((int)UnmanagedType.Bool, marshalAs.PositionalArguments.Single().GetValue(ctx));
}
[Test]
public void MethodWithOutParameter()
{
IParameter p = ctx.GetClass(typeof(ParameterTests)).Methods.Single(m => m.Name == "MethodWithOutParameter").Parameters.Single();
Assert.IsFalse(p.IsRef);
Assert.IsTrue(p.IsOut);
Assert.AreEqual(0, p.Attributes.Count);
Assert.IsTrue(p.Type is ByReferenceTypeReference);
}
[Test]
public void MethodWithParamsArray()
{
IParameter p = ctx.GetClass(typeof(ParameterTests)).Methods.Single(m => m.Name == "MethodWithParamsArray").Parameters.Single();
Assert.IsFalse(p.IsRef);
Assert.IsFalse(p.IsOut);
Assert.IsTrue(p.IsParams);
Assert.AreEqual(0, p.Attributes.Count);
Assert.IsTrue(p.Type is ArrayTypeReference);
}
}
}

10
ICSharpCode.NRefactory.VB.Tests/General/UnitTest.cs

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
using System;
using System.Reflection;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Visitors;
@ -58,10 +58,10 @@ namespace ICSharpCode.NRefactory.VB.Tests @@ -58,10 +58,10 @@ namespace ICSharpCode.NRefactory.VB.Tests
// }
[Test]
public void TestIDomVisitor()
public void TestIAstVisitor()
{
Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
Type visitor = typeof(IDomVisitor);
Type visitor = typeof(IAstVisitor);
foreach (Type type in allTypes) {
if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {
@ -79,10 +79,10 @@ namespace ICSharpCode.NRefactory.VB.Tests @@ -79,10 +79,10 @@ namespace ICSharpCode.NRefactory.VB.Tests
}
[Test]
public void TestAbstractDomVisitorVisitor()
public void TestAbstractAstVisitorVisitor()
{
Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
Type visitor = typeof(AbstractDomVisitor);
Type visitor = typeof(AbstractAstVisitor);
foreach (Type type in allTypes) {
if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {

6
ICSharpCode.NRefactory.VB.Tests/Lexer/LexerContextTests.cs

@ -481,12 +481,14 @@ End Module", @@ -481,12 +481,14 @@ End Module",
enter Expression
enter Expression
enter Expression
enter Expression
exit Expression
exit Expression
exit Expression
exit Expression
enter Expression
enter Expression
enter Expression
enter Expression
exit Expression
exit Expression
exit Expression
exit Expression

2
ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.CodeDom;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.CodeDom;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/CodeDOMTypeReferenceTest.cs

@ -5,7 +5,7 @@ using System; @@ -5,7 +5,7 @@ using System;
using System.CodeDom;
using System.Collections.Generic;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
ICSharpCode.NRefactory.VB.Tests/Output/CodeDOM/InvocationExpressionTest.cs

@ -5,7 +5,7 @@ using System; @@ -5,7 +5,7 @@ using System;
using System.CodeDom;
using System.Collections.Generic;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;

2
ICSharpCode.NRefactory.VB.Tests/Output/SpecialOutputVisitorTest.cs

@ -5,7 +5,7 @@ using System; @@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.PrettyPrinter;
using ICSharpCode.NRefactory.VB.Visitors;

2
ICSharpCode.NRefactory.VB.Tests/Output/VBNet/VBNetOutputTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.PrettyPrinter;
using ICSharpCode.NRefactory.VB.Visitors;

6
ICSharpCode.NRefactory.VB.Tests/Parser/CheckParentVisitor.cs

@ -4,15 +4,15 @@ @@ -4,15 +4,15 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
/// <summary>
/// Ensures that all nodes have the Parent property correctly set.
/// </summary>
public class CheckParentVisitor : NodeTrackingDomVisitor
public class CheckParentVisitor : NodeTrackingAstVisitor
{
Stack<INode> nodeStack = new Stack<INode>();

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AddressOfExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AddressOfExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ArrayCreateExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ArrayCreateExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/AssignmentExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AssignmentExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BaseReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class BaseReferenceExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/BinaryOperatorExpressionTests.cs

@ -5,10 +5,10 @@ using System; @@ -5,10 +5,10 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.PrettyPrinter;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class BinaryOperatorExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/CastExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class CastExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ClassReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ClassReferenceExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ConditionalExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ConditionalExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/GlobalReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class GlobalReferenceExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/IdentifierExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class IdentifierExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/InvocationExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class InvocationExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/LambdaExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LambdaExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/MemberReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class MemberReferenceExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ObjectCreateExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ObjectCreateExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ParenthesizedExpressionTest.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ParenthesizedExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/PrimitiveExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class PrimitiveExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/QueryExpressionTests.cs

@ -5,11 +5,11 @@ using System; @@ -5,11 +5,11 @@ using System;
using System.IO;
using System.Linq;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Parser;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class QueryExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ThisReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ThisReferenceExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeOfExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeOfIsExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeOfIsExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/TypeReferenceExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeReferenceExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/UnaryOperatorExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class UnaryOperatorExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class XmlExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/XmlMemberAccessExpressionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class XmlMemberAccessExpressionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/AttributeSectionTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AttributeSectionTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/DelegateDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class DelegateDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/NamespaceDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class NamespaceDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/OptionDeclarationTests.cs

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class OptionDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/TypeDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TypeDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/GlobalScope/UsingDeclarationTests.cs

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class UsingDeclarationTests

6
ICSharpCode.NRefactory.VB.Tests/Parser/LocationAssignmentCheckVisitor.cs

@ -2,13 +2,13 @@ @@ -2,13 +2,13 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using ICSharpCode.NRefactory.VB.Visitors;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
public class LocationAssignmentCheckVisitor : NodeTrackingDomVisitor
public class LocationAssignmentCheckVisitor : NodeTrackingAstVisitor
{
protected override void BeginVisit(INode node)
{

4
ICSharpCode.NRefactory.VB.Tests/Parser/ParseUtil.cs

@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
public class ParseUtil
{

2
ICSharpCode.NRefactory.VB.Tests/Parser/SnippetParserTests.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// 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 ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using System;
using NUnit.Framework;

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/AddHandlerStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class AddHandlerStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/BlockStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class BlockStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ContinueStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ContinueStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/DoLoopStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class DoLoopStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EndStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class EndStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/EraseStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class EraseStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ErrorStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ErrorStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ExpressionStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ExpressionStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForNextStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ForNextStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ForeachStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ForeachStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/GotoStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class GotoStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/IfElseStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class IfElseStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LabelStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LabelStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LocalVariableDeclarationTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LocalVariableDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/LockStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class LockStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/OnErrorStatementTest.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class OnErrorStatementTest

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RaiseEventStatementTest.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class RaiseEventStatementTest

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReDimStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ReDimStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/RemoveHandlerStatement.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class RemoveHandlerStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ResumeStatement.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ResumeStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ReturnStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ReturnStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/StopStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class StopStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/SwitchStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class SwitchStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/ThrowStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ThrowStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/TryCatchStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class TryCatchStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/UsingStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class UsingStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/Statements/WithStatementTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class WithStatementTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/ConstructorDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class ConstructorDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/CustomEventTests.cs

@ -5,9 +5,9 @@ using System; @@ -5,9 +5,9 @@ using System;
using System.IO;
using NUnit.Framework;
using ICSharpCode.NRefactory.VB.Parser;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class CustomEventTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/DeclareDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class DeclareDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/EventDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class EventDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/FieldDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class FieldDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/MethodDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class MethodDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/OperatorDeclarationTests.cs

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class OperatorDeclarationTests

4
ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/PropertyDeclarationTests.cs

@ -3,10 +3,10 @@ @@ -3,10 +3,10 @@
using System;
using System.IO;
using ICSharpCode.NRefactory.VB.Dom;
using ICSharpCode.NRefactory.VB.Ast;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
namespace ICSharpCode.NRefactory.VB.Tests.Ast
{
[TestFixture]
public class PropertyDeclarationTests

6
ICSharpCode.NRefactory.VB/Dom/AbstractNode.cs → ICSharpCode.NRefactory.VB/Ast/AbstractNode.cs

@ -7,7 +7,7 @@ using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public abstract class AbstractNode : INode
{
@ -35,9 +35,9 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -35,9 +35,9 @@ namespace ICSharpCode.NRefactory.VB.Dom
children.Add(childNode);
}
public abstract object AcceptVisitor(IDomVisitor visitor, object data);
public abstract object AcceptVisitor(IAstVisitor visitor, object data);
public virtual object AcceptChildren(IDomVisitor visitor, object data)
public virtual object AcceptChildren(IAstVisitor visitor, object data)
{
foreach (INode child in children) {
Debug.Assert(child != null);

2
ICSharpCode.NRefactory.VB/Dom/Enums.cs → ICSharpCode.NRefactory.VB/Ast/Enums.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
[Flags]
public enum Modifiers

8
ICSharpCode.NRefactory.VB/Dom/General/BlockStatement.cs → ICSharpCode.NRefactory.VB/Ast/General/BlockStatement.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public class BlockStatement : Statement
{
@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -15,7 +15,7 @@ namespace ICSharpCode.NRefactory.VB.Dom
}
}
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return visitor.VisitBlockStatement(this, data);
}
@ -37,11 +37,11 @@ namespace ICSharpCode.NRefactory.VB.Dom @@ -37,11 +37,11 @@ namespace ICSharpCode.NRefactory.VB.Dom
}
}
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return data;
}
public override object AcceptChildren(IDomVisitor visitor, object data)
public override object AcceptChildren(IAstVisitor visitor, object data)
{
return data;
}

4
ICSharpCode.NRefactory.VB/Dom/General/CompilationUnit.cs → ICSharpCode.NRefactory.VB/Ast/General/CompilationUnit.cs

@ -4,14 +4,14 @@ @@ -4,14 +4,14 @@
using System;
using System.Collections;
namespace ICSharpCode.NRefactory.VB.Dom
namespace ICSharpCode.NRefactory.VB.Ast
{
public class CompilationUnit : AbstractNode
{
// Children in C#: UsingAliasDeclaration, UsingDeclaration, AttributeSection, NamespaceDeclaration
// Children in VB: OptionStatements, ImportsStatement, AttributeSection, NamespaceDeclaration
public override object AcceptVisitor(IDomVisitor visitor, object data)
public override object AcceptVisitor(IAstVisitor visitor, object data)
{
return visitor.VisitCompilationUnit(this, data);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save