| 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 | 803 |
| 804 @override | 804 @override |
| 805 bool visitUnary(UnaryConstantExpression exp1, UnaryConstantExpression exp2) { | 805 bool visitUnary(UnaryConstantExpression exp1, UnaryConstantExpression exp2) { |
| 806 return strategy.test( | 806 return strategy.test( |
| 807 exp1, exp2, 'operator', exp1.operator, exp2.operator) && | 807 exp1, exp2, 'operator', exp1.operator, exp2.operator) && |
| 808 strategy.testConstants( | 808 strategy.testConstants( |
| 809 exp1, exp2, 'expression', exp1.expression, exp2.expression); | 809 exp1, exp2, 'expression', exp1.expression, exp2.expression); |
| 810 } | 810 } |
| 811 | 811 |
| 812 @override | 812 @override |
| 813 bool visitVariable( | 813 bool visitField(FieldConstantExpression exp1, FieldConstantExpression exp2) { |
| 814 VariableConstantExpression exp1, VariableConstantExpression exp2) { | |
| 815 return strategy.testElements( | 814 return strategy.testElements( |
| 816 exp1, exp2, 'element', exp1.element, exp2.element); | 815 exp1, exp2, 'element', exp1.element, exp2.element); |
| 817 } | 816 } |
| 817 |
| 818 @override |
| 819 bool visitLocalVariable(LocalVariableConstantExpression exp1, |
| 820 LocalVariableConstantExpression exp2) { |
| 821 return strategy.testElements( |
| 822 exp1, exp2, 'element', exp1.element, exp2.element); |
| 823 } |
| 818 | 824 |
| 819 @override | 825 @override |
| 820 bool visitBool(BoolConstantExpression exp1, BoolConstantExpression exp2) { | 826 bool visitBool(BoolConstantExpression exp1, BoolConstantExpression exp2) { |
| 821 return strategy.test( | 827 return strategy.test( |
| 822 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); | 828 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); |
| 823 } | 829 } |
| 824 | 830 |
| 825 @override | 831 @override |
| 826 bool visitDouble( | 832 bool visitDouble( |
| 827 DoubleConstantExpression exp1, DoubleConstantExpression exp2) { | 833 DoubleConstantExpression exp1, DoubleConstantExpression exp2) { |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2115 } | 2121 } |
| 2116 | 2122 |
| 2117 bool areMetadataAnnotationsEquivalent( | 2123 bool areMetadataAnnotationsEquivalent( |
| 2118 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 2124 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
| 2119 if (metadata1 == metadata2) return true; | 2125 if (metadata1 == metadata2) return true; |
| 2120 if (metadata1 == null || metadata2 == null) return false; | 2126 if (metadata1 == null || metadata2 == null) return false; |
| 2121 return areElementsEquivalent( | 2127 return areElementsEquivalent( |
| 2122 metadata1.annotatedElement, metadata2.annotatedElement) && | 2128 metadata1.annotatedElement, metadata2.annotatedElement) && |
| 2123 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 2129 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
| 2124 } | 2130 } |
| OLD | NEW |