| 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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 visitContinueStatement(ContinueStatement node) { | 1046 visitContinueStatement(ContinueStatement node) { |
| 1047 TargetElement target; | 1047 TargetElement target; |
| 1048 if (node.target === null) { | 1048 if (node.target === null) { |
| 1049 target = statementScope.currentContinueTarget(); | 1049 target = statementScope.currentContinueTarget(); |
| 1050 if (target === null) { | 1050 if (target === null) { |
| 1051 error(node, MessageKind.NO_CONTINUE_TARGET); | 1051 error(node, MessageKind.NO_CONTINUE_TARGET); |
| 1052 return; | 1052 return; |
| 1053 } | 1053 } |
| 1054 target.isContinueTarget = true; |
| 1054 } else { | 1055 } else { |
| 1055 String labelName = node.target.source.slowToString(); | 1056 String labelName = node.target.source.slowToString(); |
| 1056 LabelElement label = statementScope.lookupLabel(labelName); | 1057 LabelElement label = statementScope.lookupLabel(labelName); |
| 1057 if (label === null) { | 1058 if (label === null) { |
| 1058 error(node.target, MessageKind.UNBOUND_LABEL, [labelName]); | 1059 error(node.target, MessageKind.UNBOUND_LABEL, [labelName]); |
| 1059 return; | 1060 return; |
| 1060 } | 1061 } |
| 1061 target = label.target; | 1062 target = label.target; |
| 1062 if (!target.statement.isValidContinueTarget()) { | 1063 if (!target.statement.isValidContinueTarget()) { |
| 1063 error(node.target, MessageKind.INVALID_CONTINUE, [labelName]); | 1064 error(node.target, MessageKind.INVALID_CONTINUE, [labelName]); |
| 1064 } | 1065 } |
| 1066 label.setContinueTarget(); |
| 1065 } | 1067 } |
| 1066 target.isContinueTarget = true; | |
| 1067 mapping[node] = target; | 1068 mapping[node] = target; |
| 1068 } | 1069 } |
| 1069 | 1070 |
| 1070 visitForInStatement(ForInStatement node) { | 1071 visitForInStatement(ForInStatement node) { |
| 1071 visit(node.expression); | 1072 visit(node.expression); |
| 1072 Scope scope = new BlockScope(context); | 1073 Scope scope = new BlockScope(context); |
| 1073 Node declaration = node.declaredIdentifier; | 1074 Node declaration = node.declaredIdentifier; |
| 1074 visitIn(declaration, scope); | 1075 visitIn(declaration, scope); |
| 1075 visitLoopBodyIn(node, node.body, scope); | 1076 visitLoopBodyIn(node, node.body, scope); |
| 1076 | 1077 |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 | 1777 |
| 1777 TopScope(LibraryElement library) : super(null, library); | 1778 TopScope(LibraryElement library) : super(null, library); |
| 1778 Element lookup(SourceString name) { | 1779 Element lookup(SourceString name) { |
| 1779 return library.find(name); | 1780 return library.find(name); |
| 1780 } | 1781 } |
| 1781 | 1782 |
| 1782 Element add(Element element) { | 1783 Element add(Element element) { |
| 1783 throw "Cannot add an element in the top scope"; | 1784 throw "Cannot add an element in the top scope"; |
| 1784 } | 1785 } |
| 1785 } | 1786 } |
| OLD | NEW |