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

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

Issue 24488004: Implement correct scoping rules for variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 458
459 visitVariableDefinitions(VariableDefinitions node) { 459 visitVariableDefinitions(VariableDefinitions node) {
460 if (node.type != null) { 460 if (node.type != null) {
461 visit(node.type); 461 visit(node.type);
462 } 462 }
463 for (Link<Node> link = node.definitions.nodes; 463 for (Link<Node> link = node.definitions.nodes;
464 !link.isEmpty; 464 !link.isEmpty;
465 link = link.tail) { 465 link = link.tail) {
466 Node definition = link.head; 466 Node definition = link.head;
467 Element element = elements[definition]; 467 Element element = elements[definition];
468 assert(element != null); 468 assert(invariant(definition, element != null,
469 message: "unresolved local definition"));
469 declareLocal(element); 470 declareLocal(element);
470 // We still need to visit the right-hand sides of the init-assignments. 471 // We still need to visit the right-hand sides of the init-assignments.
471 // For SendSets don't visit the left again. Otherwise it would be marked 472 // For SendSets don't visit the left again. Otherwise it would be marked
472 // as mutated. 473 // as mutated.
473 if (definition is Send) { 474 if (definition is Send) {
474 Send assignment = definition; 475 Send assignment = definition;
475 Node arguments = assignment.argumentsNode; 476 Node arguments = assignment.argumentsNode;
476 if (arguments != null) { 477 if (arguments != null) {
477 visit(arguments); 478 visit(arguments);
478 } 479 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 838 }
838 839
839 visitTryStatement(TryStatement node) { 840 visitTryStatement(TryStatement node) {
840 // TODO(ngeoffray): implement finer grain state. 841 // TODO(ngeoffray): implement finer grain state.
841 bool oldInTryStatement = inTryStatement; 842 bool oldInTryStatement = inTryStatement;
842 inTryStatement = true; 843 inTryStatement = true;
843 node.visitChildren(this); 844 node.visitChildren(this);
844 inTryStatement = oldInTryStatement; 845 inTryStatement = oldInTryStatement;
845 } 846 }
846 } 847 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698