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

Unified Diff: lib/compiler/implementation/resolver.dart

Issue 10913133: Allow closures inside lazy initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. Created 8 years, 2 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/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index 373d01e14180cde4112be7ea551770e63a273bd2..d97d5efec7eb52a2fef553be88b833b4daea0847 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -1372,9 +1372,17 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
} else {
name = node.name.asIdentifier().source;
}
+ if (scope.element.kind == ElementKind.VARIABLE_LIST) {
+ compiler.internalError("Bad enclosing element", node: node);
+ }
+ Element functionEnclosing = scope.element;
ahe 2012/10/11 07:36:05 How about moving this assignment above the if stat
floitsch 2012/10/11 13:58:12 Done.
+ if (functionEnclosing.isLibrary()) {
+ // We are in a static initializers.
+ functionEnclosing = enclosingElement;
ahe 2012/10/11 07:36:05 This is not making any sense to me.
floitsch 2012/10/11 13:58:12 Added comments and a TODO(ahe).
+ }
FunctionElement enclosing = new FunctionElement.node(
name, node, ElementKind.FUNCTION, Modifiers.EMPTY,
- scope.element);
+ functionEnclosing);
setupFunction(node, enclosing);
defineElement(node, enclosing, doAddToScope: node.name !== null);

Powered by Google App Engine
This is Rietveld 408576698