Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Add consistency check that mutates the AST and checks if pattern matc…
Browse files Browse the repository at this point in the history
…hing finds the difference.
  • Loading branch information
dgrunwald committed Jan 5, 2013
1 parent dac867d commit 33c882d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public IEnumerable<EntityDeclaration> GetTypes(bool includeInnerTypes = false)
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
SyntaxTree o = other as SyntaxTree;
return o != null && GetChildrenByRole(MemberRole).DoMatch(o.GetChildrenByRole(MemberRole), match);
return o != null && this.Members.DoMatch(o.Members, match);
}

public override void AcceptVisitor (IAstVisitor visitor)
Expand Down
1 change: 1 addition & 0 deletions ICSharpCode.NRefactory.ConsistencyCheck/CSharpFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public CSharpFile(CSharpProject project, string fileName)
// Keep the original text around; we might use it for a refactoring later
this.OriginalText = File.ReadAllText(fileName);
this.SyntaxTree = p.Parse(this.OriginalText, fileName);
this.SyntaxTree.Freeze(); // the various tests shouldn't modify the AST shared by all tests

if (p.HasErrors) {
Console.WriteLine("Error parsing " + fileName + ":");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<Compile Include="CSharpFile.cs" />
<Compile Include="CSharpProject.cs" />
<Compile Include="FindReferencesConsistencyCheck.cs" />
<Compile Include="PatternMatchingTest.cs" />
<Compile Include="TypeSystemTests.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
1 change: 1 addition & 0 deletions ICSharpCode.NRefactory.ConsistencyCheck/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static void Main(string[] args)
RunTestOnAllFiles("Resolver test (no parsed file)", ResolverTest.RunTestWithoutUnresolvedFile);
RunTestOnAllFiles("Resolver test (randomized order)", RandomizedOrderResolverTest.RunTest);
new FindReferencesConsistencyCheck(solution).Run();
RunTestOnAllFiles("Pattern Matching test", PatternMatchingTest.RunTest);

Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
Expand Down

0 comments on commit 33c882d

Please sign in to comment.