Chromium Code Reviews| 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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1132 | 1132 |
| 1133 visitLiteralMapEntry(LiteralMapEntry node) { | 1133 visitLiteralMapEntry(LiteralMapEntry node) { |
| 1134 unimplemented(node, 'map entry'); | 1134 unimplemented(node, 'map entry'); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 visitNamedArgument(NamedArgument node) { | 1137 visitNamedArgument(NamedArgument node) { |
| 1138 visit(node.expression); | 1138 visit(node.expression); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 visitSwitchStatement(SwitchStatement node) { | 1141 visitSwitchStatement(SwitchStatement node) { |
| 1142 warning(node, MessageKind.GENERIC, ['switch statement is not implemented']); | 1142 node.expression.accept(this); |
| 1143 StatementElement element = getOrCreateStatementElement(node); | |
| 1144 statementScope.enterLoop(element); | |
|
Lasse Reichstein Nielsen
2012/03/05 19:54:04
Will need modifying (switch isn't a continue targe
ahe
2012/03/05 20:07:23
Good point. I'll probably need your help figuring
| |
| 1145 node.cases.accept(this); | |
| 1146 statementScope.exitLoop(); | |
| 1147 } | |
| 1148 | |
| 1149 visitSwitchCase(SwitchCase node) { | |
| 1150 // TODO(ahe): What about the label? | |
|
Lasse Reichstein Nielsen
2012/03/05 19:54:04
We will probably have to make two passed over the
ahe
2012/03/05 20:07:23
I was thinking about something similar.
| |
| 1151 node.expression.accept(this); | |
| 1152 node.statements.accept(this); | |
| 1153 } | |
| 1154 | |
| 1155 visitDefaultCase(DefaultCase node) { | |
| 1156 // TODO(ahe): What about the label? | |
| 1157 node.statements.accept(this); | |
| 1143 } | 1158 } |
| 1144 | 1159 |
| 1145 visitTryStatement(TryStatement node) { | 1160 visitTryStatement(TryStatement node) { |
| 1146 visit(node.tryBlock); | 1161 visit(node.tryBlock); |
| 1147 if (node.catchBlocks.isEmpty() && node.finallyBlock == null) { | 1162 if (node.catchBlocks.isEmpty() && node.finallyBlock == null) { |
| 1148 // TODO(ngeoffray): The precise location is | 1163 // TODO(ngeoffray): The precise location is |
| 1149 // node.getEndtoken.next. Adjust when issue #1581 is fixed. | 1164 // node.getEndtoken.next. Adjust when issue #1581 is fixed. |
| 1150 error(node, MessageKind.NO_CATCH_NOR_FINALLY); | 1165 error(node, MessageKind.NO_CATCH_NOR_FINALLY); |
| 1151 } | 1166 } |
| 1152 visit(node.catchBlocks); | 1167 visit(node.catchBlocks); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1463 class TopScope extends Scope { | 1478 class TopScope extends Scope { |
| 1464 LibraryElement get library() => element; | 1479 LibraryElement get library() => element; |
| 1465 | 1480 |
| 1466 TopScope(LibraryElement library) : super(null, library); | 1481 TopScope(LibraryElement library) : super(null, library); |
| 1467 Element lookup(SourceString name) => library.find(name); | 1482 Element lookup(SourceString name) => library.find(name); |
| 1468 | 1483 |
| 1469 Element add(Element element) { | 1484 Element add(Element element) { |
| 1470 throw "Cannot add an element in the top scope"; | 1485 throw "Cannot add an element in the top scope"; |
| 1471 } | 1486 } |
| 1472 } | 1487 } |
| OLD | NEW |