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

Side by Side Diff: pkg/compiler/lib/src/closure.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 | « no previous file | pkg/compiler/lib/src/common/tasks.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 closureToClassMapper; 5 library closureToClassMapper;
6 6
7 import 'common.dart'; 7 import 'common.dart';
8 import 'common/names.dart' show Identifiers; 8 import 'common/names.dart' show Identifiers;
9 import 'common/resolution.dart' show ParsingContext, Resolution; 9 import 'common/resolution.dart' show ParsingContext, Resolution;
10 import 'common/tasks.dart' show CompilerTask; 10 import 'common/tasks.dart' show CompilerTask;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return visitor.visitClosureClassElement(this, arg); 248 return visitor.visitClosureClassElement(this, arg);
249 } 249 }
250 } 250 }
251 251
252 /// A local variable that contains the box object holding the [BoxFieldElement] 252 /// A local variable that contains the box object holding the [BoxFieldElement]
253 /// fields. 253 /// fields.
254 class BoxLocal extends Local { 254 class BoxLocal extends Local {
255 final String name; 255 final String name;
256 final ExecutableElement executableContext; 256 final ExecutableElement executableContext;
257 257
258 final int hashCode = _nextHashCode = (_nextHashCode + 10007).toUnsigned(30);
259 static int _nextHashCode = 0;
260
258 BoxLocal(this.name, this.executableContext); 261 BoxLocal(this.name, this.executableContext);
259 262
260 String toString() => 'BoxLocal($name)'; 263 String toString() => 'BoxLocal($name)';
261 } 264 }
262 265
263 // TODO(ngeoffray, ahe): These classes continuously cause problems. We need to 266 // TODO(ngeoffray, ahe): These classes continuously cause problems. We need to
264 // find a more general solution. 267 // find a more general solution.
265 class BoxFieldElement extends ElementX 268 class BoxFieldElement extends ElementX
266 implements 269 implements
267 TypedElement, 270 TypedElement,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 @override 322 @override
320 bool get hasConstant => false; 323 bool get hasConstant => false;
321 324
322 @override 325 @override
323 ConstantExpression get constant => null; 326 ConstantExpression get constant => null;
324 } 327 }
325 328
326 /// A local variable used encode the direct (uncaptured) references to [this]. 329 /// A local variable used encode the direct (uncaptured) references to [this].
327 class ThisLocal extends Local { 330 class ThisLocal extends Local {
328 final ExecutableElement executableContext; 331 final ExecutableElement executableContext;
329 final hashCode = ++ElementX.elementHashCode; 332 final hashCode = ElementX.newHashCode();
330 333
331 ThisLocal(this.executableContext); 334 ThisLocal(this.executableContext);
332 335
333 String get name => 'this'; 336 String get name => 'this';
334 337
335 ClassElement get enclosingClass => executableContext.enclosingClass; 338 ClassElement get enclosingClass => executableContext.enclosingClass;
336 } 339 }
337 340
338 /// Call method of a closure class. 341 /// Call method of a closure class.
339 class SynthesizedCallMethodElementX extends BaseFunctionElementX 342 class SynthesizedCallMethodElementX extends BaseFunctionElementX
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 /// 1192 ///
1190 /// Move the below classes to a JS model eventually. 1193 /// Move the below classes to a JS model eventually.
1191 /// 1194 ///
1192 abstract class JSEntity implements Entity { 1195 abstract class JSEntity implements Entity {
1193 Entity get declaredEntity; 1196 Entity get declaredEntity;
1194 } 1197 }
1195 1198
1196 abstract class PrivatelyNamedJSEntity implements JSEntity { 1199 abstract class PrivatelyNamedJSEntity implements JSEntity {
1197 Entity get rootOfScope; 1200 Entity get rootOfScope;
1198 } 1201 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/common/tasks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698