| 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 942 |
| 943 visitLabelledStatement(LabelledStatement node) { | 943 visitLabelledStatement(LabelledStatement node) { |
| 944 String labelName = node.label.source.stringValue; | 944 String labelName = node.label.source.stringValue; |
| 945 StatementElement existingElement = statementScope.lookupLabel(labelName); | 945 StatementElement existingElement = statementScope.lookupLabel(labelName); |
| 946 if (existingElement !== null) { | 946 if (existingElement !== null) { |
| 947 LabelledStatement declaration = existingElement.origin; | 947 LabelledStatement declaration = existingElement.origin; |
| 948 warning(node.label, MessageKind.DUPLICATE_LABEL, [labelName]); | 948 warning(node.label, MessageKind.DUPLICATE_LABEL, [labelName]); |
| 949 warning(declaration.label, MessageKind.EXISTING_LABEL, [labelName]); | 949 warning(declaration.label, MessageKind.EXISTING_LABEL, [labelName]); |
| 950 } | 950 } |
| 951 StatementElement element = | 951 StatementElement element = |
| 952 new StatementElement.Label(labelName, node, enclosingElement); | 952 new StatementElement.label(labelName, node, enclosingElement); |
| 953 statementScope.enterLabelScope(labelName, element); | 953 statementScope.enterLabelScope(labelName, element); |
| 954 visit(node.statement); | 954 visit(node.statement); |
| 955 statementScope.exitLabelScope(); | 955 statementScope.exitLabelScope(); |
| 956 if (element.isTarget) { | 956 if (element.isTarget) { |
| 957 mapping[node] = element; | 957 mapping[node] = element; |
| 958 } else { | 958 } else { |
| 959 warning(node.label, MessageKind.UNUSED_LABEL, [labelName]); | 959 warning(node.label, MessageKind.UNUSED_LABEL, [labelName]); |
| 960 } | 960 } |
| 961 } | 961 } |
| 962 | 962 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 class TopScope extends Scope { | 1292 class TopScope extends Scope { |
| 1293 LibraryElement get library() => element; | 1293 LibraryElement get library() => element; |
| 1294 | 1294 |
| 1295 TopScope(LibraryElement library) : super(null, library); | 1295 TopScope(LibraryElement library) : super(null, library); |
| 1296 Element lookup(SourceString name) => library.find(name); | 1296 Element lookup(SourceString name) => library.find(name); |
| 1297 | 1297 |
| 1298 Element add(Element element) { | 1298 Element add(Element element) { |
| 1299 throw "Cannot add an element in the top scope"; | 1299 throw "Cannot add an element in the top scope"; |
| 1300 } | 1300 } |
| 1301 } | 1301 } |
| OLD | NEW |