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

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

Issue 22947008: Refine the type of a local after it has been used as the receiver of a call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 this.thisElement) 257 this.thisElement)
258 : this.freeVariableMapping = new Map<Element, Element>(), 258 : this.freeVariableMapping = new Map<Element, Element>(),
259 this.capturedFieldMapping = new Map<Element, Element>(), 259 this.capturedFieldMapping = new Map<Element, Element>(),
260 this.capturingScopes = new Map<Node, ClosureScope>(), 260 this.capturingScopes = new Map<Node, ClosureScope>(),
261 this.usedVariablesInTry = new Set<Element>(), 261 this.usedVariablesInTry = new Set<Element>(),
262 this.parametersWithSentinel = new Map<Element, Element>(); 262 this.parametersWithSentinel = new Map<Element, Element>();
263 263
264 bool isClosure() => closureElement != null; 264 bool isClosure() => closureElement != null;
265 265
266 bool isVariableCaptured(Element element) { 266 bool isVariableCaptured(Element element) {
267 freeVariableMapping.containsKey(element); 267 return freeVariableMapping.containsKey(element);
268 } 268 }
269 269
270 bool isVariableBoxed(Element element) { 270 bool isVariableBoxed(Element element) {
271 Element copy = freeVariableMapping[element]; 271 Element copy = freeVariableMapping[element];
272 return copy != null && !copy.isMember(); 272 return copy != null && !copy.isMember();
273 } 273 }
274 274
275 void forEachCapturedVariable(void f(Element local, Element field)) { 275 void forEachCapturedVariable(void f(Element local, Element field)) {
276 freeVariableMapping.forEach((variable, copy) { 276 freeVariableMapping.forEach((variable, copy) {
277 if (variable is BoxElement) return; 277 if (variable is BoxElement) return;
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 } 825 }
826 826
827 visitTryStatement(TryStatement node) { 827 visitTryStatement(TryStatement node) {
828 // TODO(ngeoffray): implement finer grain state. 828 // TODO(ngeoffray): implement finer grain state.
829 bool oldInTryStatement = inTryStatement; 829 bool oldInTryStatement = inTryStatement;
830 inTryStatement = true; 830 inTryStatement = true;
831 node.visitChildren(this); 831 node.visitChildren(this);
832 inTryStatement = oldInTryStatement; 832 inTryStatement = oldInTryStatement;
833 } 833 }
834 } 834 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698