| 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 '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common/resolution.dart'; | 10 import '../common/resolution.dart'; |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 bool testTokens( | 1444 bool testTokens( |
| 1445 var object1, var object2, String property, Token token1, Token token2) { | 1445 var object1, var object2, String property, Token token1, Token token2) { |
| 1446 return strategy.test(object1, object2, property, token1, token2, | 1446 return strategy.test(object1, object2, property, token1, token2, |
| 1447 (Token t1, Token t2) { | 1447 (Token t1, Token t2) { |
| 1448 if (t1 == t2) return true; | 1448 if (t1 == t2) return true; |
| 1449 if (t1 == null || t2 == null) return false; | 1449 if (t1 == null || t2 == null) return false; |
| 1450 return strategy.test( | 1450 return strategy.test( |
| 1451 t1, t2, 'charOffset', t1.charOffset, t2.charOffset) && | 1451 t1, t2, 'charOffset', t1.charOffset, t2.charOffset) && |
| 1452 strategy.test(t1, t2, 'info', t1.info, t2.info) && | 1452 strategy.test(t1, t2, 'info', t1.type, t2.type) && |
| 1453 strategy.test(t1, t2, 'value', t1.lexeme, t2.lexeme); | 1453 strategy.test(t1, t2, 'value', t1.lexeme, t2.lexeme); |
| 1454 }); | 1454 }); |
| 1455 } | 1455 } |
| 1456 | 1456 |
| 1457 @override | 1457 @override |
| 1458 bool visitAssert(Assert node1, Assert node2) { | 1458 bool visitAssert(Assert node1, Assert node2) { |
| 1459 return testTokens(node1, node2, 'assertToken', node1.assertToken, | 1459 return testTokens(node1, node2, 'assertToken', node1.assertToken, |
| 1460 node2.assertToken) && | 1460 node2.assertToken) && |
| 1461 testNodes( | 1461 testNodes( |
| 1462 node1, node2, 'condition', node1.condition, node2.condition) && | 1462 node1, node2, 'condition', node1.condition, node2.condition) && |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 } | 2144 } |
| 2145 | 2145 |
| 2146 bool areMetadataAnnotationsEquivalent( | 2146 bool areMetadataAnnotationsEquivalent( |
| 2147 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 2147 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
| 2148 if (metadata1 == metadata2) return true; | 2148 if (metadata1 == metadata2) return true; |
| 2149 if (metadata1 == null || metadata2 == null) return false; | 2149 if (metadata1 == null || metadata2 == null) return false; |
| 2150 return areElementsEquivalent( | 2150 return areElementsEquivalent( |
| 2151 metadata1.annotatedElement, metadata2.annotatedElement) && | 2151 metadata1.annotatedElement, metadata2.annotatedElement) && |
| 2152 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 2152 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
| 2153 } | 2153 } |
| OLD | NEW |