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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 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 "scanner/scannerlib.dart" show Token; 9 import "scanner/scannerlib.dart" show Token;
10 import "tree/tree.dart"; 10 import "tree/tree.dart";
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 607
608 ClosureClassMap savedClosureData = closureData; 608 ClosureClassMap savedClosureData = closureData;
609 bool savedInsideClosure = insideClosure; 609 bool savedInsideClosure = insideClosure;
610 610
611 // Restore old values. 611 // Restore old values.
612 insideClosure = oldInsideClosure; 612 insideClosure = oldInsideClosure;
613 closureData = oldClosureData; 613 closureData = oldClosureData;
614 currentElement = oldFunctionElement; 614 currentElement = oldFunctionElement;
615 615
616 // Mark all free variables as captured and use them in the outer function. 616 // Mark all free variables as captured and use them in the outer function.
617 List<Element> freeVariables = savedClosureData.freeVariableMapping.keys; 617 Iterable<Element> freeVariables = savedClosureData.freeVariableMapping.keys;
618 assert(freeVariables.isEmpty || savedInsideClosure); 618 assert(freeVariables.isEmpty || savedInsideClosure);
619 for (Element freeElement in freeVariables) { 619 for (Element freeElement in freeVariables) {
620 if (capturedVariableMapping[freeElement] != null && 620 if (capturedVariableMapping[freeElement] != null &&
621 capturedVariableMapping[freeElement] != freeElement) { 621 capturedVariableMapping[freeElement] != freeElement) {
622 compiler.internalError('In closure analyzer', node: node); 622 compiler.internalError('In closure analyzer', node: node);
623 } 623 }
624 capturedVariableMapping[freeElement] = freeElement; 624 capturedVariableMapping[freeElement] = freeElement;
625 useLocal(freeElement); 625 useLocal(freeElement);
626 } 626 }
627 } 627 }
(...skipping 23 matching lines...) Expand all
651 } 651 }
652 652
653 visitTryStatement(TryStatement node) { 653 visitTryStatement(TryStatement node) {
654 // TODO(ngeoffray): implement finer grain state. 654 // TODO(ngeoffray): implement finer grain state.
655 bool oldInTryStatement = inTryStatement; 655 bool oldInTryStatement = inTryStatement;
656 inTryStatement = true; 656 inTryStatement = true;
657 node.visitChildren(this); 657 node.visitChildren(this);
658 inTryStatement = oldInTryStatement; 658 inTryStatement = oldInTryStatement;
659 } 659 }
660 } 660 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/apiimpl.dart ('k') | sdk/lib/_internal/compiler/implementation/code_buffer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698