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

Side by Side 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 another 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 abstract class TreeElements { 5 abstract class TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 DartType getType(TypeAnnotation annotation); 8 DartType getType(TypeAnnotation annotation);
9 bool isParameterChecked(Element element); 9 bool isParameterChecked(Element element);
10 } 10 }
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 } 1362 }
1363 1363
1364 visitFunctionExpression(FunctionExpression node) { 1364 visitFunctionExpression(FunctionExpression node) {
1365 visit(node.returnType); 1365 visit(node.returnType);
1366 SourceString name; 1366 SourceString name;
1367 if (node.name === null) { 1367 if (node.name === null) {
1368 name = const SourceString(""); 1368 name = const SourceString("");
1369 } else { 1369 } else {
1370 name = node.name.asIdentifier().source; 1370 name = node.name.asIdentifier().source;
1371 } 1371 }
1372 if (scope.element.kind == ElementKind.VARIABLE_LIST) {
1373 compiler.internalError("Bad enclosing element", node: node);
1374 }
1372 FunctionElement enclosing = new FunctionElement.node( 1375 FunctionElement enclosing = new FunctionElement.node(
1373 name, node, ElementKind.FUNCTION, Modifiers.EMPTY, 1376 name, node, ElementKind.FUNCTION, Modifiers.EMPTY,
1374 scope.element); 1377 scope.element);
1375 setupFunction(node, enclosing); 1378 setupFunction(node, enclosing);
1376 defineElement(node, enclosing, doAddToScope: node.name !== null); 1379 defineElement(node, enclosing, doAddToScope: node.name !== null);
1377 1380
1378 // Run the body in a fresh statement scope. 1381 // Run the body in a fresh statement scope.
1379 StatementScope oldScope = statementScope; 1382 StatementScope oldScope = statementScope;
1380 statementScope = new StatementScope(); 1383 statementScope = new StatementScope();
1381 visit(node.body); 1384 visit(node.body);
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 return result; 3139 return result;
3137 } 3140 }
3138 Element lookup(SourceString name) => localLookup(name); 3141 Element lookup(SourceString name) => localLookup(name);
3139 Element lexicalLookup(SourceString name) => localLookup(name); 3142 Element lexicalLookup(SourceString name) => localLookup(name);
3140 3143
3141 Element add(Element newElement) { 3144 Element add(Element newElement) {
3142 throw "Cannot add an element in a patch library scope"; 3145 throw "Cannot add an element in a patch library scope";
3143 } 3146 }
3144 String toString() => 'PatchLibraryScope($origin,$patch)'; 3147 String toString() => 'PatchLibraryScope($origin,$patch)';
3145 } 3148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698