Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: pkg/compiler/lib/src/constants/expressions.dart

Issue 2154583002: dart2js: get:hashCode methods to avoid Object.hashCode (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: xxx Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/common/tasks.dart ('k') | pkg/compiler/lib/src/dart_types.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/tasks.dart ('k') | pkg/compiler/lib/src/dart_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698