OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Functions for asserting equivalence across serialization. | 5 /// Functions for asserting equivalence across serialization. |
6 | 6 |
7 library dart2js.serialization.equivalence; | 7 library dart2js.serialization.equivalence; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/resolution.dart'; | 10 import '../common/resolution.dart'; |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 if (resolvedAst1.kind != ResolvedAstKind.PARSED) { | 764 if (resolvedAst1.kind != ResolvedAstKind.PARSED) { |
765 // Nothing more to check. | 765 // Nothing more to check. |
766 return true; | 766 return true; |
767 } | 767 } |
768 return strategy.testElements(resolvedAst1, resolvedAst2, 'element', | 768 return strategy.testElements(resolvedAst1, resolvedAst2, 'element', |
769 resolvedAst1.element, resolvedAst2.element) && | 769 resolvedAst1.element, resolvedAst2.element) && |
770 new NodeEquivalenceVisitor(strategy).testNodes(resolvedAst1, resolvedAst2, | 770 new NodeEquivalenceVisitor(strategy).testNodes(resolvedAst1, resolvedAst2, |
771 'node', resolvedAst1.node, resolvedAst2.node) && | 771 'node', resolvedAst1.node, resolvedAst2.node) && |
772 new NodeEquivalenceVisitor(strategy).testNodes(resolvedAst1, resolvedAst2, | 772 new NodeEquivalenceVisitor(strategy).testNodes(resolvedAst1, resolvedAst2, |
773 'body', resolvedAst1.body, resolvedAst2.body) && | 773 'body', resolvedAst1.body, resolvedAst2.body) && |
774 testTreeElementsEquivalence(resolvedAst1, resolvedAst2, strategy); | 774 testTreeElementsEquivalence(resolvedAst1, resolvedAst2, strategy) && |
| 775 strategy.test(resolvedAst1, resolvedAst2, 'sourceUri', |
| 776 resolvedAst1.sourceUri, resolvedAst2.sourceUri); |
775 } | 777 } |
776 | 778 |
777 /// Tests the equivalence of the data stored in the [TreeElements] of | 779 /// Tests the equivalence of the data stored in the [TreeElements] of |
778 /// [resolvedAst1] and [resolvedAst2] using [strategy]. | 780 /// [resolvedAst1] and [resolvedAst2] using [strategy]. |
779 bool testTreeElementsEquivalence( | 781 bool testTreeElementsEquivalence( |
780 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, | 782 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, |
781 [TestStrategy strategy = const TestStrategy()]) { | 783 [TestStrategy strategy = const TestStrategy()]) { |
782 AstIndexComputer indices1 = new AstIndexComputer(); | 784 AstIndexComputer indices1 = new AstIndexComputer(); |
783 resolvedAst1.node.accept(indices1); | 785 resolvedAst1.node.accept(indices1); |
784 AstIndexComputer indices2 = new AstIndexComputer(); | 786 AstIndexComputer indices2 = new AstIndexComputer(); |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 @override | 1757 @override |
1756 bool visitStatement(Statement node1, Statement node2) { | 1758 bool visitStatement(Statement node1, Statement node2) { |
1757 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 1759 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
1758 } | 1760 } |
1759 | 1761 |
1760 @override | 1762 @override |
1761 bool visitStringNode(StringNode node1, StringNode node2) { | 1763 bool visitStringNode(StringNode node1, StringNode node2) { |
1762 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 1764 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
1763 } | 1765 } |
1764 } | 1766 } |
OLD | NEW |