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

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

Issue 206193002: Remove cancel and make crash exit with code 253. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 9 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 "dart_types.dart"; 9 import "dart_types.dart";
10 import "scanner/scannerlib.dart" show Token; 10 import "scanner/scannerlib.dart" show Token;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 assert(closureMappingCache[node] != null); 61 assert(closureMappingCache[node] != null);
62 return closureMappingCache[node]; 62 return closureMappingCache[node];
63 }); 63 });
64 } 64 }
65 65
66 ClosureClassMap getMappingForNestedFunction(FunctionExpression node) { 66 ClosureClassMap getMappingForNestedFunction(FunctionExpression node) {
67 return measure(() { 67 return measure(() {
68 ClosureClassMap nestedClosureData = closureMappingCache[node]; 68 ClosureClassMap nestedClosureData = closureMappingCache[node];
69 if (nestedClosureData == null) { 69 if (nestedClosureData == null) {
70 compiler.internalError("No closure cache", node: node); 70 compiler.internalError(node, "No closure cache.");
71 } 71 }
72 return nestedClosureData; 72 return nestedClosureData;
73 }); 73 });
74 } 74 }
75 } 75 }
76 76
77 // TODO(ahe): These classes continuously cause problems. We need to 77 // TODO(ahe): These classes continuously cause problems. We need to
78 // move these classes to elements/modelx.dart or see if we can find a 78 // move these classes to elements/modelx.dart or see if we can find a
79 // more general solution. 79 // more general solution.
80 class ClosureFieldElement extends ElementX implements VariableElement { 80 class ClosureFieldElement extends ElementX implements VariableElement {
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 insideClosure = oldInsideClosure; 792 insideClosure = oldInsideClosure;
793 closureData = oldClosureData; 793 closureData = oldClosureData;
794 currentElement = oldFunctionElement; 794 currentElement = oldFunctionElement;
795 795
796 // Mark all free variables as captured and use them in the outer function. 796 // Mark all free variables as captured and use them in the outer function.
797 Iterable<Element> freeVariables = savedClosureData.freeVariableMapping.keys; 797 Iterable<Element> freeVariables = savedClosureData.freeVariableMapping.keys;
798 assert(freeVariables.isEmpty || savedInsideClosure); 798 assert(freeVariables.isEmpty || savedInsideClosure);
799 for (Element freeElement in freeVariables) { 799 for (Element freeElement in freeVariables) {
800 if (capturedVariableMapping[freeElement] != null && 800 if (capturedVariableMapping[freeElement] != null &&
801 capturedVariableMapping[freeElement] != freeElement) { 801 capturedVariableMapping[freeElement] != freeElement) {
802 compiler.internalError('In closure analyzer', node: node); 802 compiler.internalError(node, 'In closure analyzer.');
803 } 803 }
804 capturedVariableMapping[freeElement] = freeElement; 804 capturedVariableMapping[freeElement] = freeElement;
805 useLocal(freeElement); 805 useLocal(freeElement);
806 } 806 }
807 } 807 }
808 808
809 visitFunctionExpression(FunctionExpression node) { 809 visitFunctionExpression(FunctionExpression node) {
810 Element element = elements[node]; 810 Element element = elements[node];
811 811
812 if (element.isParameter()) { 812 if (element.isParameter()) {
(...skipping 18 matching lines...) Expand all
831 } 831 }
832 832
833 visitTryStatement(TryStatement node) { 833 visitTryStatement(TryStatement node) {
834 // TODO(ngeoffray): implement finer grain state. 834 // TODO(ngeoffray): implement finer grain state.
835 bool oldInTryStatement = inTryStatement; 835 bool oldInTryStatement = inTryStatement;
836 inTryStatement = true; 836 inTryStatement = true;
837 node.visitChildren(this); 837 node.visitChildren(this);
838 inTryStatement = oldInTryStatement; 838 inTryStatement = oldInTryStatement;
839 } 839 }
840 } 840 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698