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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10916079: Allow access to super fields inside a closure. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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: lib/compiler/implementation/ssa/codegen.dart
===================================================================
--- lib/compiler/implementation/ssa/codegen.dart (revision 11771)
+++ lib/compiler/implementation/ssa/codegen.dart (working copy)
@@ -1531,9 +1531,12 @@
Element superClass = superMethod.getEnclosingClass();
// Remove the element and 'this'.
int argumentCount = node.inputs.length - 2;
- String className = compiler.namer.isolateAccess(superClass);
if (superMethod.kind == ElementKind.FIELD) {
ClassElement currentClass = work.element.getEnclosingClass();
+ if (currentClass.isClosure()) {
+ ClosureClassElement closure = currentClass;
+ currentClass = closure.originalElement.getEnclosingClass();
+ }
String fieldName;
if (currentClass.isShadowedByField(superMethod)) {
fieldName = compiler.namer.shadowedFieldName(superMethod);
@@ -1542,8 +1545,9 @@
SourceString name = superMethod.name;
fieldName = compiler.namer.instanceFieldName(library, name);
}
+ use(node.inputs[1]);
js.PropertyAccess access =
- new js.PropertyAccess.field(new js.This(), fieldName);
+ new js.PropertyAccess.field(pop(), fieldName);
if (node.isSetter) {
use(node.value);
push(new js.Assignment(access, pop()), node);
@@ -1564,6 +1568,7 @@
methodName =
compiler.namer.setterName(currentLibrary, superMethod.name);
}
+ String className = compiler.namer.isolateAccess(superClass);
js.VariableUse classReference = new js.VariableUse(className);
js.PropertyAccess prototype =
new js.PropertyAccess.field(classReference, "prototype");

Powered by Google App Engine
This is Rietveld 408576698