| 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.dart'; | 10 import '../common.dart'; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 CompilationUnitElement element1, CompilationUnitElement element2) { | 376 CompilationUnitElement element1, CompilationUnitElement element2) { |
| 377 return strategy.test( | 377 return strategy.test( |
| 378 element1, element2, 'name', element1.name, element2.name) && | 378 element1, element2, 'name', element1.name, element2.name) && |
| 379 strategy.test(element1, element2, 'script.resourceUri', | 379 strategy.test(element1, element2, 'script.resourceUri', |
| 380 element1.script.resourceUri, element2.script.resourceUri) && | 380 element1.script.resourceUri, element2.script.resourceUri) && |
| 381 visit(element1.library, element2.library); | 381 visit(element1.library, element2.library); |
| 382 } | 382 } |
| 383 | 383 |
| 384 @override | 384 @override |
| 385 bool visitClassElement(ClassElement element1, ClassElement element2) { | 385 bool visitClassElement(ClassElement element1, ClassElement element2) { |
| 386 return strategy.test( | 386 if (!strategy.test(element1, element2, 'isUnnamedMixinApplication', |
| 387 element1, element2, 'name', element1.name, element2.name) && | 387 element1.isUnnamedMixinApplication, |
| 388 visit(element1.library, element2.library); | 388 element2.isUnnamedMixinApplication)) { |
| 389 return false; |
| 390 } |
| 391 if (element1.isUnnamedMixinApplication) { |
| 392 MixinApplicationElement mixin1 = element1; |
| 393 MixinApplicationElement mixin2 = element2; |
| 394 return strategy.testElements(mixin1, mixin2, 'subclass', |
| 395 mixin1.subclass, mixin2.subclass) && |
| 396 // Using the [mixinType] is more precise but requires the test to |
| 397 // handle self references: The identity of a type variable is based on |
| 398 // its type declaration and if [mixin1] is generic the [mixinType] |
| 399 // will contain the type variables declared by [mixin1], i.e. |
| 400 // `abstract class Mixin<T> implements MixinType<T> {}` |
| 401 strategy.testElements(mixin1, mixin2, 'mixin', |
| 402 mixin1.mixin, mixin2.mixin); |
| 403 } else { |
| 404 return strategy.test( |
| 405 element1, element2, 'name', element1.name, element2.name) && |
| 406 visit(element1.library, element2.library); |
| 407 } |
| 389 } | 408 } |
| 390 | 409 |
| 391 bool checkMembers(Element element1, Element element2) { | 410 bool checkMembers(Element element1, Element element2) { |
| 392 if (!strategy.test( | 411 if (!strategy.test( |
| 393 element1, element2, 'name', element1.name, element2.name)) { | 412 element1, element2, 'name', element1.name, element2.name)) { |
| 394 return false; | 413 return false; |
| 395 } | 414 } |
| 396 if (element1.enclosingClass != null || element2.enclosingClass != null) { | 415 if (element1.enclosingClass != null || element2.enclosingClass != null) { |
| 397 return visit(element1.enclosingClass, element2.enclosingClass); | 416 return visit(element1.enclosingClass, element2.enclosingClass); |
| 398 } else { | 417 } else { |
| (...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 @override | 1819 @override |
| 1801 bool visitStatement(Statement node1, Statement node2) { | 1820 bool visitStatement(Statement node1, Statement node2) { |
| 1802 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 1821 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
| 1803 } | 1822 } |
| 1804 | 1823 |
| 1805 @override | 1824 @override |
| 1806 bool visitStringNode(StringNode node1, StringNode node2) { | 1825 bool visitStringNode(StringNode node1, StringNode node2) { |
| 1807 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 1826 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
| 1808 } | 1827 } |
| 1809 } | 1828 } |
| OLD | NEW |