Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(959)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/tree/nodes.dart

Issue 698563005: Support parsing of enums in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add unparser test. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 Cascade asCascade() => null; 147 Cascade asCascade() => null;
147 CascadeReceiver asCascadeReceiver() => null; 148 CascadeReceiver asCascadeReceiver() => null;
148 CaseMatch asCaseMatch() => null; 149 CaseMatch asCaseMatch() => null;
149 CatchBlock asCatchBlock() => null; 150 CatchBlock asCatchBlock() => null;
150 ClassNode asClassNode() => null; 151 ClassNode asClassNode() => null;
151 Combinator asCombinator() => null; 152 Combinator asCombinator() => null;
152 Conditional asConditional() => null; 153 Conditional asConditional() => null;
153 ContinueStatement asContinueStatement() => null; 154 ContinueStatement asContinueStatement() => null;
154 DoWhile asDoWhile() => null; 155 DoWhile asDoWhile() => null;
155 EmptyStatement asEmptyStatement() => null; 156 EmptyStatement asEmptyStatement() => null;
157 Enum asEnum() => null;
156 ErrorExpression asErrorExpression() => null; 158 ErrorExpression asErrorExpression() => null;
157 Export asExport() => null; 159 Export asExport() => null;
158 Expression asExpression() => null; 160 Expression asExpression() => null;
159 ExpressionStatement asExpressionStatement() => null; 161 ExpressionStatement asExpressionStatement() => null;
160 For asFor() => null; 162 For asFor() => null;
161 ForIn asForIn() => null; 163 ForIn asForIn() => null;
162 FunctionDeclaration asFunctionDeclaration() => null; 164 FunctionDeclaration asFunctionDeclaration() => null;
163 FunctionExpression asFunctionExpression() => null; 165 FunctionExpression asFunctionExpression() => null;
164 Identifier asIdentifier() => null; 166 Identifier asIdentifier() => null;
165 If asIf() => null; 167 If asIf() => null;
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 Token getBeginToken() => importKeyword; 1846 Token getBeginToken() => importKeyword;
1845 1847
1846 Token getEndToken() { 1848 Token getEndToken() {
1847 if (combinators != null) return combinators.getEndToken().next; 1849 if (combinators != null) return combinators.getEndToken().next;
1848 if (prefix != null) return prefix.getEndToken().next; 1850 if (prefix != null) return prefix.getEndToken().next;
1849 return uri.getEndToken().next; 1851 return uri.getEndToken().next;
1850 } 1852 }
1851 } 1853 }
1852 1854
1853 /** 1855 /**
1856 * An `enum` declaration.
1857 *
1858 * An `enum` defines a number of named constants inside a non-extensible class
1859 */
1860 class Enum extends Node {
1861 /** The name of the enum class. */
1862 final Identifier name;
1863 /** The names of the enum constants. */
1864 final NodeList names;
1865 final Token enumToken;
1866
1867 Enum(this.enumToken, this.name, this.names);
1868
1869 Enum asEnum() => this;
1870
1871 accept(Visitor visitor) => visitor.visitEnum(this);
1872
1873 visitChildren(Visitor visitor) {
1874 name.accept(visitor);
1875 if (names != null) names.accept(visitor);
1876 }
1877
1878 Token getBeginToken() => enumToken;
1879 Token getEndToken() => names.getEndToken();
1880 }
1881
1882 /**
1854 * An [:export:] library tag. 1883 * An [:export:] library tag.
1855 * 1884 *
1856 * An export tag is dependency on another library where the exported identifiers 1885 * An export tag is dependency on another library where the exported identifiers
1857 * are put into the export scope of the exporting library. The export scope is 1886 * are put into the export scope of the exporting library. The export scope is
1858 * not visible inside the library. 1887 * not visible inside the library.
1859 */ 1888 */
1860 class Export extends LibraryDependency { 1889 class Export extends LibraryDependency {
1861 final Token exportKeyword; 1890 final Token exportKeyword;
1862 1891
1863 Export(this.exportKeyword, 1892 Export(this.exportKeyword,
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 2209
2181 // VariableDefinitions. 2210 // VariableDefinitions.
2182 get metadata => null; 2211 get metadata => null;
2183 get type => null; 2212 get type => null;
2184 2213
2185 // Typedef. 2214 // Typedef.
2186 get typeParameters => null; 2215 get typeParameters => null;
2187 get formals => null; 2216 get formals => null;
2188 get typedefKeyword => null; 2217 get typedefKeyword => null;
2189 } 2218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698