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

Unified Diff: frog/leg/ssa/closure.dart

Issue 9327001: Implement super initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 10 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: frog/leg/ssa/closure.dart
diff --git a/frog/leg/ssa/closure.dart b/frog/leg/ssa/closure.dart
index eead9b947743bb1ceeaabe9ec24ac6aa3d5a3f88..f8b6143d5019e017d1157caa41c86c5e1a8357c9 100644
--- a/frog/leg/ssa/closure.dart
+++ b/frog/leg/ssa/closure.dart
@@ -147,7 +147,13 @@ class ClosureTranslator extends AbstractVisitor {
}
void useLocal(Element element) {
- if (element.enclosingElement != currentFunctionElement) {
+ // TODO(floitsch): replace this with a general solution.
+ Element functionElement = currentFunctionElement;
+ if (functionElement.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) {
+ ConstructorBodyElement body = functionElement;
+ functionElement = body.constructor;
+ }
+ if (element.enclosingElement != functionElement) {
assert(closureData.freeVariableMapping[element] == null ||
closureData.freeVariableMapping[element] == element);
closureData.freeVariableMapping[element] = element;

Powered by Google App Engine
This is Rietveld 408576698