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 abstract class Visitor<R> { | 5 abstract class Visitor<R> { |
6 const Visitor(); | 6 const Visitor(); |
7 | 7 |
8 abstract R visitNode(Node node); | 8 abstract R visitNode(Node node); |
9 | 9 |
10 R visitBlock(Block node) => visitStatement(node); | 10 R visitBlock(Block node) => visitStatement(node); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 R visitLoop(Loop node) => visitStatement(node); | 47 R visitLoop(Loop node) => visitStatement(node); |
48 R visitModifiers(Modifiers node) => visitNode(node); | 48 R visitModifiers(Modifiers node) => visitNode(node); |
49 R visitNamedArgument(NamedArgument node) => visitExpression(node); | 49 R visitNamedArgument(NamedArgument node) => visitExpression(node); |
50 R visitNewExpression(NewExpression node) => visitExpression(node); | 50 R visitNewExpression(NewExpression node) => visitExpression(node); |
51 R visitNodeList(NodeList node) => visitNode(node); | 51 R visitNodeList(NodeList node) => visitNode(node); |
52 R visitOperator(Operator node) => visitIdentifier(node); | 52 R visitOperator(Operator node) => visitIdentifier(node); |
53 R visitParenthesizedExpression(ParenthesizedExpression node) { | 53 R visitParenthesizedExpression(ParenthesizedExpression node) { |
54 return visitExpression(node); | 54 return visitExpression(node); |
55 } | 55 } |
56 R visitPart(Part node) => visitLibraryTag(node); | 56 R visitPart(Part node) => visitLibraryTag(node); |
57 R visitPartOf(PartOf node) => visitLibraryTag(node); | 57 R visitPartOf(PartOf node) => visitNode(node); |
58 R visitPostfix(Postfix node) => visitNodeList(node); | 58 R visitPostfix(Postfix node) => visitNodeList(node); |
59 R visitPrefix(Prefix node) => visitNodeList(node); | 59 R visitPrefix(Prefix node) => visitNodeList(node); |
60 R visitReturn(Return node) => visitStatement(node); | 60 R visitReturn(Return node) => visitStatement(node); |
61 R visitScriptTag(ScriptTag node) => visitNode(node); | 61 R visitScriptTag(ScriptTag node) => visitNode(node); |
62 R visitSend(Send node) => visitExpression(node); | 62 R visitSend(Send node) => visitExpression(node); |
63 R visitSendSet(SendSet node) => visitSend(node); | 63 R visitSendSet(SendSet node) => visitSend(node); |
64 R visitStatement(Statement node) => visitNode(node); | 64 R visitStatement(Statement node) => visitNode(node); |
65 R visitStringNode(StringNode node) => visitExpression(node); | 65 R visitStringNode(StringNode node) => visitExpression(node); |
66 R visitStringInterpolation(StringInterpolation node) => visitStringNode(node); | 66 R visitStringInterpolation(StringInterpolation node) => visitStringNode(node); |
67 R visitStringInterpolationPart(StringInterpolationPart node) { | 67 R visitStringInterpolationPart(StringInterpolationPart node) { |
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 | 1752 |
1753 accept(Visitor visitor) => visitor.visitPart(this); | 1753 accept(Visitor visitor) => visitor.visitPart(this); |
1754 | 1754 |
1755 visitChildren(Visitor visitor) => uri.accept(visitor); | 1755 visitChildren(Visitor visitor) => uri.accept(visitor); |
1756 | 1756 |
1757 Token getBeginToken() => partKeyword; | 1757 Token getBeginToken() => partKeyword; |
1758 | 1758 |
1759 Token getEndToken() => uri.getEndToken().next; | 1759 Token getEndToken() => uri.getEndToken().next; |
1760 } | 1760 } |
1761 | 1761 |
1762 class PartOf extends LibraryTag { | 1762 class PartOf extends Node { |
1763 final Expression name; | 1763 final Expression name; |
1764 | 1764 |
1765 final Token partKeyword; | 1765 final Token partKeyword; |
1766 | 1766 |
1767 PartOf(this.partKeyword, this.name); | 1767 PartOf(this.partKeyword, this.name); |
1768 | 1768 |
1769 Token get ofKeyword => partKeyword.next; | 1769 Token get ofKeyword => partKeyword.next; |
1770 | 1770 |
1771 bool get isPartOf => true; | 1771 bool get isPartOf => true; |
1772 | 1772 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 * argument). | 1977 * argument). |
1978 * | 1978 * |
1979 * TODO(ahe): This method is controversial, the team needs to discuss | 1979 * TODO(ahe): This method is controversial, the team needs to discuss |
1980 * if top-level methods are acceptable and what naming conventions to | 1980 * if top-level methods are acceptable and what naming conventions to |
1981 * use. | 1981 * use. |
1982 */ | 1982 */ |
1983 initializerDo(Node node, f(Node node)) { | 1983 initializerDo(Node node, f(Node node)) { |
1984 SendSet send = node.asSendSet(); | 1984 SendSet send = node.asSendSet(); |
1985 if (send !== null) return f(send.arguments.head); | 1985 if (send !== null) return f(send.arguments.head); |
1986 } | 1986 } |
OLD | NEW |