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

Unified Diff: pkg/compiler/lib/src/closure.dart

Issue 3009903002: Pass in `this` as a free variable to the closure class (Closed)
Patch Set: merge with master Created 3 years, 4 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
Index: pkg/compiler/lib/src/closure.dart
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 7831c90877471e9cde7239d160de6cdc6576720e..e95088ff5b63d34494380a5de29844d0e24573a6 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -615,7 +615,6 @@ class BoxFieldElement extends ElementX
/// A local variable used encode the direct (uncaptured) references to [this].
class ThisLocal extends Local {
final MemberEntity memberContext;
- final hashCode = ElementX.newHashCode();
ThisLocal(this.memberContext);
@@ -624,6 +623,15 @@ class ThisLocal extends Local {
String get name => 'this';
ClassEntity get enclosingClass => memberContext.enclosingClass;
+
+ bool operator ==(other) {
+ return other is ThisLocal &&
+ other.name == name &&
+ other.memberContext == memberContext &&
+ other.enclosingClass == enclosingClass;
+ }
+
+ int get hashCode => memberContext.hashCode + enclosingClass.hashCode;
}
/// Call method of a closure class.
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart » ('j') | tests/language_2/language_2_dart2js.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698