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

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

Issue 10915054: Mark the local for this as used if a constructor call needs type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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("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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 visitSendSet(SendSet node) { 312 visitSendSet(SendSet node) {
313 Element element = elements[node]; 313 Element element = elements[node];
314 if (Elements.isLocal(element)) { 314 if (Elements.isLocal(element)) {
315 mutatedVariables.add(element); 315 mutatedVariables.add(element);
316 } 316 }
317 super.visitSendSet(node); 317 super.visitSendSet(node);
318 } 318 }
319 319
320 visitNewExpression(NewExpression node) {
321 bool hasTypeVariable(DartType type) {
322 if (type is TypeVariableType) {
323 return true;
324 } else if (type is InterfaceType) {
325 InterfaceType ifcType = type;
326 for (DartType argument in ifcType.arguments) {
327 if (hasTypeVariable(argument)) {
328 return true;
329 }
330 }
331 }
332 return false;
333 }
334 TypeAnnotation annotation = node.send.getTypeAnnotation();
335 DartType type = elements.getType(annotation);
336 if (hasTypeVariable(type)) {
337 // TODO(karlklose): factories cannot get the type argument via this.
ngeoffray 2012/09/03 12:57:23 The resolve must have checked this already. Either
karlklose 2012/09/03 13:55:19 Done.
338 if (closureData.thisElement !== null) {
339 useLocal(closureData.thisElement);
340 }
341 }
342 node.visitChildren(this);
343 }
344
320 // If variables that are declared in the [node] scope are captured and need 345 // If variables that are declared in the [node] scope are captured and need
321 // to be boxed create a box-element and update the [capturingScopes] in the 346 // to be boxed create a box-element and update the [capturingScopes] in the
322 // current [closureData]. 347 // current [closureData].
323 // The boxed variables are updated in the [capturedVariableMapping]. 348 // The boxed variables are updated in the [capturedVariableMapping].
324 void attachCapturedScopeVariables(Node node) { 349 void attachCapturedScopeVariables(Node node) {
325 Element box = null; 350 Element box = null;
326 Map<Element, Element> scopeMapping = new Map<Element, Element>(); 351 Map<Element, Element> scopeMapping = new Map<Element, Element>();
327 for (Element element in scopeVariables) { 352 for (Element element in scopeVariables) {
328 // No need to box non-assignable elements. 353 // No need to box non-assignable elements.
329 if (!element.isAssignable()) continue; 354 if (!element.isAssignable()) continue;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 524 }
500 525
501 visitTryStatement(TryStatement node) { 526 visitTryStatement(TryStatement node) {
502 // TODO(ngeoffray): implement finer grain state. 527 // TODO(ngeoffray): implement finer grain state.
503 bool oldInTryStatement = inTryStatement; 528 bool oldInTryStatement = inTryStatement;
504 inTryStatement = true; 529 inTryStatement = true;
505 node.visitChildren(this); 530 node.visitChildren(this);
506 inTryStatement = oldInTryStatement; 531 inTryStatement = oldInTryStatement;
507 } 532 }
508 } 533 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698