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 Visitor<R> { | 5 interface Visitor<R> { |
6 R visitBlock(Block node); | 6 R visitBlock(Block node); |
7 R visitBreakStatement(BreakStatement node); | 7 R visitBreakStatement(BreakStatement node); |
8 R visitCascade(Cascade node); | 8 R visitCascade(Cascade node); |
9 R visitCascadeReceiver(CascadeReceiver node); | 9 R visitCascadeReceiver(CascadeReceiver node); |
10 R visitCatchBlock(CatchBlock node); | 10 R visitCatchBlock(CatchBlock node); |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 | 1368 |
1369 Link<Token> caseKeywords() { | 1369 Link<Token> caseKeywords() { |
1370 Token token = startToken; | 1370 Token token = startToken; |
1371 if (label !== null) { | 1371 if (label !== null) { |
1372 // Skip past the label: <Identifier> ':'. | 1372 // Skip past the label: <Identifier> ':'. |
1373 token = token.next.next; | 1373 token = token.next.next; |
1374 } | 1374 } |
1375 LinkBuilder<Token> builder = new LinkBuilder<Token>(); | 1375 LinkBuilder<Token> builder = new LinkBuilder<Token>(); |
1376 Link<Expression> link = expressions.nodes; | 1376 Link<Expression> link = expressions.nodes; |
1377 while (token.stringValue === 'case') { | 1377 while (token.stringValue === 'case') { |
1378 assert(token.next === link.head.getBeginToken(0)); | 1378 assert(token.next === link.head.getBeginToken()); |
1379 builder.addLast(token); | 1379 builder.addLast(token); |
1380 Token colon = link.head.getEndToken().next; | 1380 Token colon = link.head.getEndToken().next; |
1381 token = colon.next; | 1381 token = colon.next; |
1382 link = link.tail; | 1382 link = link.tail; |
1383 } | 1383 } |
1384 return builder.toLink(); | 1384 return builder.toLink(); |
1385 } | 1385 } |
1386 } | 1386 } |
1387 | 1387 |
1388 class GotoStatement extends Statement { | 1388 class GotoStatement extends Statement { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 * argument). | 1681 * argument). |
1682 * | 1682 * |
1683 * TODO(ahe): This method is controversial, the team needs to discuss | 1683 * TODO(ahe): This method is controversial, the team needs to discuss |
1684 * if top-level methods are acceptable and what naming conventions to | 1684 * if top-level methods are acceptable and what naming conventions to |
1685 * use. | 1685 * use. |
1686 */ | 1686 */ |
1687 initializerDo(Node node, f(Node node)) { | 1687 initializerDo(Node node, f(Node node)) { |
1688 SendSet send = node.asSendSet(); | 1688 SendSet send = node.asSendSet(); |
1689 if (send !== null) return f(send.arguments.head); | 1689 if (send !== null) return f(send.arguments.head); |
1690 } | 1690 } |
OLD | NEW |