| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.constants.expressions; | 5 library dart2js.constants.expressions; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../constants/constant_system.dart'; | 8 import '../constants/constant_system.dart'; |
| 9 import '../core_types.dart'; | 9 import '../core_types.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 StringBuffer sb = new StringBuffer(); | 94 StringBuffer sb = new StringBuffer(); |
| 95 _createStructuredText(sb); | 95 _createStructuredText(sb); |
| 96 return sb.toString(); | 96 return sb.toString(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 /// Writes the structure of the constant into [sb]. | 99 /// Writes the structure of the constant into [sb]. |
| 100 void _createStructuredText(StringBuffer sb); | 100 void _createStructuredText(StringBuffer sb); |
| 101 | 101 |
| 102 int _computeHashCode(); | 102 int _computeHashCode(); |
| 103 | 103 |
| 104 int get hashCode { | 104 int get hashCode => _hashCode ??= _computeHashCode(); |
| 105 if (_hashCode == null) { | |
| 106 _hashCode = _computeHashCode(); | |
| 107 } | |
| 108 return _hashCode; | |
| 109 } | |
| 110 | 105 |
| 111 bool _equals(ConstantExpression other); | 106 bool _equals(ConstantExpression other); |
| 112 | 107 |
| 113 bool operator ==(other) { | 108 bool operator ==(other) { |
| 114 if (identical(this, other)) return true; | 109 if (identical(this, other)) return true; |
| 115 if (other is! ConstantExpression) return false; | 110 if (other is! ConstantExpression) return false; |
| 116 if (kind != other.kind) return false; | 111 if (kind != other.kind) return false; |
| 117 if (hashCode != other.hashCode) return false; | 112 if (hashCode != other.hashCode) return false; |
| 118 return _equals(other); | 113 return _equals(other); |
| 119 } | 114 } |
| (...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 visit(exp.name); | 1881 visit(exp.name); |
| 1887 if (exp.defaultValue != null) { | 1882 if (exp.defaultValue != null) { |
| 1888 sb.write(', defaultValue: '); | 1883 sb.write(', defaultValue: '); |
| 1889 visit(exp.defaultValue); | 1884 visit(exp.defaultValue); |
| 1890 } | 1885 } |
| 1891 sb.write(')'); | 1886 sb.write(')'); |
| 1892 } | 1887 } |
| 1893 | 1888 |
| 1894 String toString() => sb.toString(); | 1889 String toString() => sb.toString(); |
| 1895 } | 1890 } |
| OLD | NEW |