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

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

Issue 10982089: Remove AbstractVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/compile_time_constants.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("leg.dart"); 8 #import("leg.dart");
9 #import("scanner/scannerlib.dart"); 9 #import("scanner/scannerlib.dart");
10 #import("tree/tree.dart"); 10 #import("tree/tree.dart");
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 this.thisElement) 151 this.thisElement)
152 : this.freeVariableMapping = new Map<Element, Element>(), 152 : this.freeVariableMapping = new Map<Element, Element>(),
153 this.capturedFieldMapping = new Map<Element, Element>(), 153 this.capturedFieldMapping = new Map<Element, Element>(),
154 this.capturingScopes = new Map<Node, ClosureScope>(), 154 this.capturingScopes = new Map<Node, ClosureScope>(),
155 this.usedVariablesInTry = new Set<Element>(), 155 this.usedVariablesInTry = new Set<Element>(),
156 this.parametersWithSentinel = new Map<Element, Element>(); 156 this.parametersWithSentinel = new Map<Element, Element>();
157 157
158 bool isClosure() => closureElement !== null; 158 bool isClosure() => closureElement !== null;
159 } 159 }
160 160
161 class ClosureTranslator extends AbstractVisitor { 161 class ClosureTranslator extends Visitor {
162 final Compiler compiler; 162 final Compiler compiler;
163 final TreeElements elements; 163 final TreeElements elements;
164 int closureFieldCounter = 0; 164 int closureFieldCounter = 0;
165 bool inTryStatement = false; 165 bool inTryStatement = false;
166 final Map<Node, ClosureClassMap> closureMappingCache; 166 final Map<Node, ClosureClassMap> closureMappingCache;
167 167
168 // Map of captured variables. Initially they will map to themselves. If 168 // Map of captured variables. Initially they will map to themselves. If
169 // a variable needs to be boxed then the scope declaring the variable 169 // a variable needs to be boxed then the scope declaring the variable
170 // will update this mapping. 170 // will update this mapping.
171 Map<Element, Element> capturedVariableMapping; 171 Map<Element, Element> capturedVariableMapping;
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 597 }
598 598
599 visitTryStatement(TryStatement node) { 599 visitTryStatement(TryStatement node) {
600 // TODO(ngeoffray): implement finer grain state. 600 // TODO(ngeoffray): implement finer grain state.
601 bool oldInTryStatement = inTryStatement; 601 bool oldInTryStatement = inTryStatement;
602 inTryStatement = true; 602 inTryStatement = true;
603 node.visitChildren(this); 603 node.visitChildren(this);
604 inTryStatement = oldInTryStatement; 604 inTryStatement = oldInTryStatement;
605 } 605 }
606 } 606 }
OLDNEW
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/compile_time_constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698