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

Side by Side Diff: lib/compiler/implementation/closure.dart

Issue 11273121: Support closures inside initializers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 library closureToClassMapper; 5 library closureToClassMapper;
6 6
7 import "elements/elements.dart"; 7 import "elements/elements.dart";
8 import "dart2jslib.dart"; 8 import "dart2jslib.dart";
9 import "tree/tree.dart"; 9 import "tree/tree.dart";
10 import "util/util.dart"; 10 import "util/util.dart";
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 assert(closureMappingCache[node] != null); 39 assert(closureMappingCache[node] != null);
40 return closureMappingCache[node]; 40 return closureMappingCache[node];
41 }); 41 });
42 } 42 }
43 43
44 ClosureClassMap getMappingForNestedFunction(FunctionExpression node) { 44 ClosureClassMap getMappingForNestedFunction(FunctionExpression node) {
45 return measure(() { 45 return measure(() {
46 ClosureClassMap nestedClosureData = closureMappingCache[node]; 46 ClosureClassMap nestedClosureData = closureMappingCache[node];
47 if (nestedClosureData == null) { 47 if (nestedClosureData == null) {
48 // TODO(floitsch): we can only assume that the reason for not having a 48 // TODO(floitsch): we can only assume that the reason for not having a
floitsch 2012/10/31 10:14:50 Remove TODO and make it an internal error.
ngeoffray 2012/10/31 11:28:40 Done.
49 // closure data here is, because the function is inside an initializer. 49 // closure data here is, because the function is inside an initializer.
50 compiler.unimplemented("Closures inside initializers", node: node); 50 compiler.unimplemented("Closures inside initializers", node: node);
51 } 51 }
52 return nestedClosureData; 52 return nestedClosureData;
53 }); 53 });
54 } 54 }
55 } 55 }
56 56
57 class ClosureFieldElement extends Element { 57 class ClosureFieldElement extends Element {
58 ClosureFieldElement(SourceString name, ClassElement enclosing) 58 ClosureFieldElement(SourceString name, ClassElement enclosing)
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 return node.name.accept(this); 606 return node.name.accept(this);
607 } 607 }
608 608
609 visitInvokable(element, node, () { 609 visitInvokable(element, node, () {
610 // TODO(ahe): This is problematic. The backend should not repeat 610 // TODO(ahe): This is problematic. The backend should not repeat
611 // the work of the resolver. It is the resolver's job to create 611 // the work of the resolver. It is the resolver's job to create
612 // parameters, etc. Other phases should only visit statements. 612 // parameters, etc. Other phases should only visit statements.
613 // TODO(floitsch): we avoid visiting the initializers on purpose so that 613 // TODO(floitsch): we avoid visiting the initializers on purpose so that
614 // we get an error-message later in the builder. 614 // we get an error-message later in the builder.
615 if (node.parameters != null) node.parameters.accept(this); 615 if (node.parameters != null) node.parameters.accept(this);
616 if (node.initializers != null) node.initializers.accept(this);
616 if (node.body != null) node.body.accept(this); 617 if (node.body != null) node.body.accept(this);
617 }); 618 });
618 } 619 }
619 620
620 visitFunctionDeclaration(FunctionDeclaration node) { 621 visitFunctionDeclaration(FunctionDeclaration node) {
621 node.visitChildren(this); 622 node.visitChildren(this);
622 declareLocal(elements[node]); 623 declareLocal(elements[node]);
623 } 624 }
624 625
625 visitTryStatement(TryStatement node) { 626 visitTryStatement(TryStatement node) {
626 // TODO(ngeoffray): implement finer grain state. 627 // TODO(ngeoffray): implement finer grain state.
627 bool oldInTryStatement = inTryStatement; 628 bool oldInTryStatement = inTryStatement;
628 inTryStatement = true; 629 inTryStatement = true;
629 node.visitChildren(this); 630 node.visitChildren(this);
630 inTryStatement = oldInTryStatement; 631 inTryStatement = oldInTryStatement;
631 } 632 }
632 } 633 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698