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

Unified Diff: pkg/compiler/lib/src/elements/modelx.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/elements/modelx.dart
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index d832c07f9b10054efdc313f5c77ede1b6f3ef844..a087bcf01593acb1bc18c5e65357b44e21d6467d 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -39,12 +39,14 @@ import 'visitor.dart' show ElementVisitor;
abstract class DeclarationSite {}
abstract class ElementX extends Element with ElementCommon {
- static int elementHashCode = 0;
+ static int _elementHashCode = 0;
+ static int newHashCode() =>
+ _elementHashCode = (_elementHashCode + 1).toUnsigned(30);
final String name;
final ElementKind kind;
final Element enclosingElement;
- final int hashCode = ++elementHashCode;
+ final int hashCode = newHashCode();
List<MetadataAnnotation> metadataInternal;
ElementX(this.name, this.kind, this.enclosingElement) {
@@ -3186,6 +3188,8 @@ class JumpTargetX implements JumpTarget {
bool isBreakTarget = false;
bool isContinueTarget = false;
+ final int hashCode = ElementX.newHashCode();
+
JumpTargetX(this.statement, this.nestingLevel, this.executableContext);
String get name => "target";
@@ -3285,6 +3289,8 @@ abstract class MetadataAnnotationX implements MetadataAnnotation {
Token get endToken;
+ final int hashCode = ElementX.newHashCode();
+
MetadataAnnotationX([this.resolutionState = STATE_NOT_STARTED]);
MetadataAnnotation ensureResolved(Resolution resolution) {
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698