| OLD | NEW |
| 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 interface TreeElements { | 5 interface TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class TreeElementMapping implements TreeElements { | 10 class TreeElementMapping implements TreeElements { |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 String labelName = node.target.source.slowToString(); | 1047 String labelName = node.target.source.slowToString(); |
| 1048 LabelElement label = statementScope.lookupLabel(labelName); | 1048 LabelElement label = statementScope.lookupLabel(labelName); |
| 1049 if (label === null) { | 1049 if (label === null) { |
| 1050 error(node.target, MessageKind.UNBOUND_LABEL, [labelName]); | 1050 error(node.target, MessageKind.UNBOUND_LABEL, [labelName]); |
| 1051 return; | 1051 return; |
| 1052 } | 1052 } |
| 1053 target = label.target; | 1053 target = label.target; |
| 1054 label.setBreakTarget(); | 1054 label.setBreakTarget(); |
| 1055 mapping[node.target] = label; | 1055 mapping[node.target] = label; |
| 1056 } | 1056 } |
| 1057 assert(mapping[node] === null || mapping[node] === target); | 1057 if (mapping[node] !== null && mapping[node] !== target) { |
| 1058 cancel(node, "internal error"); |
| 1059 } |
| 1058 mapping[node] = target; | 1060 mapping[node] = target; |
| 1059 } | 1061 } |
| 1060 | 1062 |
| 1061 visitContinueStatement(ContinueStatement node) { | 1063 visitContinueStatement(ContinueStatement node) { |
| 1062 StatementElement target; | 1064 StatementElement target; |
| 1063 if (node.target === null) { | 1065 if (node.target === null) { |
| 1064 target = statementScope.currentContinueTarget(); | 1066 target = statementScope.currentContinueTarget(); |
| 1065 if (target === null) { | 1067 if (target === null) { |
| 1066 error(node, MessageKind.NO_CONTINUE_TARGET); | 1068 error(node, MessageKind.NO_CONTINUE_TARGET); |
| 1067 return; | 1069 return; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 class TopScope extends Scope { | 1463 class TopScope extends Scope { |
| 1462 LibraryElement get library() => element; | 1464 LibraryElement get library() => element; |
| 1463 | 1465 |
| 1464 TopScope(LibraryElement library) : super(null, library); | 1466 TopScope(LibraryElement library) : super(null, library); |
| 1465 Element lookup(SourceString name) => library.find(name); | 1467 Element lookup(SourceString name) => library.find(name); |
| 1466 | 1468 |
| 1467 Element add(Element element) { | 1469 Element add(Element element) { |
| 1468 throw "Cannot add an element in the top scope"; | 1470 throw "Cannot add an element in the top scope"; |
| 1469 } | 1471 } |
| 1470 } | 1472 } |
| OLD | NEW |