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 part of tree; | 5 part of tree; |
| 6 | 6 |
| 7 abstract class Visitor<R> { | 7 abstract class Visitor<R> { |
| 8 const Visitor(); | 8 const Visitor(); |
| 9 | 9 |
| 10 R visitNode(Node node); | 10 R visitNode(Node node); |
| 11 | 11 |
| 12 R visitBlock(Block node) => visitStatement(node); | 12 R visitBlock(Block node) => visitStatement(node); |
| 13 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); | 13 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); |
| 14 R visitCascade(Cascade node) => visitExpression(node); | 14 R visitCascade(Cascade node) => visitExpression(node); |
| 15 R visitCascadeReceiver(CascadeReceiver node) => visitExpression(node); | 15 R visitCascadeReceiver(CascadeReceiver node) => visitExpression(node); |
| 16 R visitCaseMatch(CaseMatch node) => visitNode(node); | 16 R visitCaseMatch(CaseMatch node) => visitNode(node); |
| 17 R visitCatchBlock(CatchBlock node) => visitNode(node); | 17 R visitCatchBlock(CatchBlock node) => visitNode(node); |
| 18 R visitClassNode(ClassNode node) => visitNode(node); | 18 R visitClassNode(ClassNode node) => visitNode(node); |
| 19 R visitCombinator(Combinator node) => visitNode(node); | 19 R visitCombinator(Combinator node) => visitNode(node); |
| 20 R visitConditional(Conditional node) => visitExpression(node); | 20 R visitConditional(Conditional node) => visitExpression(node); |
| 21 R visitContinueStatement(ContinueStatement node) => visitGotoStatement(node); | 21 R visitContinueStatement(ContinueStatement node) => visitGotoStatement(node); |
| 22 R visitDoWhile(DoWhile node) => visitLoop(node); | 22 R visitDoWhile(DoWhile node) => visitLoop(node); |
| 23 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); | 23 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); |
| 24 R visitEnum(Enum node) => visitNode(node); | |
| 24 R visitExport(Export node) => visitLibraryDependency(node); | 25 R visitExport(Export node) => visitLibraryDependency(node); |
| 25 R visitExpression(Expression node) => visitNode(node); | 26 R visitExpression(Expression node) => visitNode(node); |
| 26 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); | 27 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); |
| 27 R visitFor(For node) => visitLoop(node); | 28 R visitFor(For node) => visitLoop(node); |
| 28 R visitForIn(ForIn node) => visitLoop(node); | 29 R visitForIn(ForIn node) => visitLoop(node); |
| 29 R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node); | 30 R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node); |
| 30 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); | 31 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); |
| 31 R visitGotoStatement(GotoStatement node) => visitStatement(node); | 32 R visitGotoStatement(GotoStatement node) => visitStatement(node); |
| 32 R visitIdentifier(Identifier node) => visitExpression(node); | 33 R visitIdentifier(Identifier node) => visitExpression(node); |
| 33 R visitIf(If node) => visitStatement(node); | 34 R visitIf(If node) => visitStatement(node); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 Cascade asCascade() => null; | 144 Cascade asCascade() => null; |
| 144 CascadeReceiver asCascadeReceiver() => null; | 145 CascadeReceiver asCascadeReceiver() => null; |
| 145 CaseMatch asCaseMatch() => null; | 146 CaseMatch asCaseMatch() => null; |
| 146 CatchBlock asCatchBlock() => null; | 147 CatchBlock asCatchBlock() => null; |
| 147 ClassNode asClassNode() => null; | 148 ClassNode asClassNode() => null; |
| 148 Combinator asCombinator() => null; | 149 Combinator asCombinator() => null; |
| 149 Conditional asConditional() => null; | 150 Conditional asConditional() => null; |
| 150 ContinueStatement asContinueStatement() => null; | 151 ContinueStatement asContinueStatement() => null; |
| 151 DoWhile asDoWhile() => null; | 152 DoWhile asDoWhile() => null; |
| 152 EmptyStatement asEmptyStatement() => null; | 153 EmptyStatement asEmptyStatement() => null; |
| 154 Enum asEnum() => null; | |
| 153 ErrorExpression asErrorExpression() => null; | 155 ErrorExpression asErrorExpression() => null; |
| 154 Export asExport() => null; | 156 Export asExport() => null; |
| 155 Expression asExpression() => null; | 157 Expression asExpression() => null; |
| 156 ExpressionStatement asExpressionStatement() => null; | 158 ExpressionStatement asExpressionStatement() => null; |
| 157 For asFor() => null; | 159 For asFor() => null; |
| 158 ForIn asForIn() => null; | 160 ForIn asForIn() => null; |
| 159 FunctionDeclaration asFunctionDeclaration() => null; | 161 FunctionDeclaration asFunctionDeclaration() => null; |
| 160 FunctionExpression asFunctionExpression() => null; | 162 FunctionExpression asFunctionExpression() => null; |
| 161 Identifier asIdentifier() => null; | 163 Identifier asIdentifier() => null; |
| 162 If asIf() => null; | 164 If asIf() => null; |
| (...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1822 Token getBeginToken() => importKeyword; | 1824 Token getBeginToken() => importKeyword; |
| 1823 | 1825 |
| 1824 Token getEndToken() { | 1826 Token getEndToken() { |
| 1825 if (combinators != null) return combinators.getEndToken().next; | 1827 if (combinators != null) return combinators.getEndToken().next; |
| 1826 if (prefix != null) return prefix.getEndToken().next; | 1828 if (prefix != null) return prefix.getEndToken().next; |
| 1827 return uri.getEndToken().next; | 1829 return uri.getEndToken().next; |
| 1828 } | 1830 } |
| 1829 } | 1831 } |
| 1830 | 1832 |
| 1831 /** | 1833 /** |
| 1834 * An `enum` declaration. | |
| 1835 * | |
| 1836 * An `enum` defines a number of named constants inside a non-extensible class | |
| 1837 */ | |
| 1838 class Enum extends Node { | |
| 1839 /** The name of the enum class. */ | |
| 1840 final Identifier name; | |
| 1841 /** The names of the enum constants. */ | |
| 1842 final NodeList names; | |
| 1843 final Token enumToken; | |
| 1844 | |
| 1845 Enum(this.enumToken, this.name, this.names); | |
| 1846 | |
| 1847 Enum asEnum() => this; | |
| 1848 | |
| 1849 accept(Visitor visitor) => visitor.visitEnum(this); | |
| 1850 | |
| 1851 visitChcildren(Visitor visitor) { | |
|
floitsch
2014/05/12 09:51:11
visitChildren
| |
| 1852 name.accept(visitor); | |
| 1853 if (names != null) names.accept(visitor); | |
| 1854 } | |
| 1855 | |
| 1856 Token getBeginToken() => enumToken; | |
| 1857 Token getEndToken() => names.getEndToken(); | |
| 1858 } | |
| 1859 | |
| 1860 /** | |
| 1832 * An [:export:] library tag. | 1861 * An [:export:] library tag. |
| 1833 * | 1862 * |
| 1834 * An export tag is dependency on another library where the exported identifiers | 1863 * An export tag is dependency on another library where the exported identifiers |
| 1835 * are put into the export scope of the exporting library. The export scope is | 1864 * are put into the export scope of the exporting library. The export scope is |
| 1836 * not visible inside the library. | 1865 * not visible inside the library. |
| 1837 */ | 1866 */ |
| 1838 class Export extends LibraryDependency { | 1867 class Export extends LibraryDependency { |
| 1839 final Token exportKeyword; | 1868 final Token exportKeyword; |
| 1840 | 1869 |
| 1841 Export(this.exportKeyword, | 1870 Export(this.exportKeyword, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2105 } | 2134 } |
| 2106 | 2135 |
| 2107 class IsInterpolationVisitor extends Visitor<bool> { | 2136 class IsInterpolationVisitor extends Visitor<bool> { |
| 2108 const IsInterpolationVisitor(); | 2137 const IsInterpolationVisitor(); |
| 2109 bool visitNode(Node node) => false; | 2138 bool visitNode(Node node) => false; |
| 2110 bool visitStringInterpolation(StringInterpolation node) => true; | 2139 bool visitStringInterpolation(StringInterpolation node) => true; |
| 2111 bool visitStringJuxtaposition(StringJuxtaposition node) | 2140 bool visitStringJuxtaposition(StringJuxtaposition node) |
| 2112 => node.isInterpolation; | 2141 => node.isInterpolation; |
| 2113 } | 2142 } |
| 2114 | 2143 |
| OLD | NEW |