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

Unified Diff: pkg/compiler/lib/src/js_model/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/js_model/closure.dart
diff --git a/pkg/compiler/lib/src/js_model/closure.dart b/pkg/compiler/lib/src/js_model/closure.dart
index 0d9a9df1764227379ffeda3a30605821a994d4bf..61cc575f151c06307dee6954abcabd24fc2e6ba7 100644
--- a/pkg/compiler/lib/src/js_model/closure.dart
+++ b/pkg/compiler/lib/src/js_model/closure.dart
@@ -293,8 +293,15 @@ class JsScopeInfo extends ScopeInfo {
info.hasThisLocal ? new ThisLocal(localsMap.currentMember) : null,
this.localsUsedInTryOrSync =
info.localsUsedInTryOrSync.map(localsMap.getLocalVariable).toSet(),
- this.freeVariables =
- info.freeVariables.map(localsMap.getLocalVariable).toSet();
+ this.freeVariables = new Set<Local>() {
+ for (var variable in info.freeVariables) {
+ if (variable is ThisVariable) {
+ freeVariables.add(thisLocal);
+ } else {
+ freeVariables.add(localsMap.getLocalVariable(variable));
+ }
+ }
+ }
void forEachBoxedVariable(f(Local local, FieldEntity field)) {
boxedVariables.forEach((Local l, JRecordField box) {

Powered by Google App Engine
This is Rietveld 408576698