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

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

Issue 3009903002: Pass in `this` as a free variable to the closure class (Closed)
Patch Set: . 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 a7edec4140187cf5555cd10763e374bcce93932b..13f3b64806263e23903fdfa7d75f63346a140304 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 ==(obj) {
sra1 2017/08/31 16:26:54 use 'other' for consistency with other implementat
Emily Fortuna 2017/08/31 17:40:52 Done.
+ return obj is ThisLocal &&
+ obj.name == name &&
+ obj.memberContext == memberContext &&
+ obj.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_model/closure.dart » ('j') | pkg/compiler/lib/src/js_model/closure_visitors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698