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/resolution.dart'; | 9 import '../common/resolution.dart'; |
10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 } | 750 } |
751 | 751 |
752 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy]. | 752 /// Tests the equivalence of [resolvedAst1] and [resolvedAst2] using [strategy]. |
753 bool testResolvedAstEquivalence( | 753 bool testResolvedAstEquivalence( |
754 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, | 754 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, |
755 [TestStrategy strategy = const TestStrategy()]) { | 755 [TestStrategy strategy = const TestStrategy()]) { |
756 return strategy.testElements(resolvedAst1, resolvedAst2, 'element', | 756 return strategy.testElements(resolvedAst1, resolvedAst2, 'element', |
757 resolvedAst1.element, resolvedAst2.element) && | 757 resolvedAst1.element, resolvedAst2.element) && |
758 new NodeEquivalenceVisitor(strategy).testNodes(resolvedAst1, resolvedAst2, | 758 new NodeEquivalenceVisitor(strategy).testNodes(resolvedAst1, resolvedAst2, |
759 'node', resolvedAst1.node, resolvedAst2.node) && | 759 'node', resolvedAst1.node, resolvedAst2.node) && |
| 760 new NodeEquivalenceVisitor(strategy).testNodes(resolvedAst1, resolvedAst2, |
| 761 'body', resolvedAst1.body, resolvedAst2.body) && |
760 testTreeElementsEquivalence(resolvedAst1, resolvedAst2, strategy); | 762 testTreeElementsEquivalence(resolvedAst1, resolvedAst2, strategy); |
761 } | 763 } |
762 | 764 |
763 /// Tests the equivalence of the data stored in the [TreeElements] of | 765 /// Tests the equivalence of the data stored in the [TreeElements] of |
764 /// [resolvedAst1] and [resolvedAst2] using [strategy]. | 766 /// [resolvedAst1] and [resolvedAst2] using [strategy]. |
765 bool testTreeElementsEquivalence( | 767 bool testTreeElementsEquivalence( |
766 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, | 768 ResolvedAst resolvedAst1, ResolvedAst resolvedAst2, |
767 [TestStrategy strategy = const TestStrategy()]) { | 769 [TestStrategy strategy = const TestStrategy()]) { |
768 AstIndexComputer indices1 = new AstIndexComputer(); | 770 AstIndexComputer indices1 = new AstIndexComputer(); |
769 resolvedAst1.node.accept(indices1); | 771 resolvedAst1.node.accept(indices1); |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 @override | 1689 @override |
1688 bool visitStatement(Statement node1, Statement node2) { | 1690 bool visitStatement(Statement node1, Statement node2) { |
1689 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 1691 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
1690 } | 1692 } |
1691 | 1693 |
1692 @override | 1694 @override |
1693 bool visitStringNode(StringNode node1, StringNode node2) { | 1695 bool visitStringNode(StringNode node1, StringNode node2) { |
1694 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 1696 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
1695 } | 1697 } |
1696 } | 1698 } |
OLD | NEW |