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

Side by Side Diff: dart/frog/leg/tree/nodes.dart

Issue 8508016: Create class AST nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: frogsh Created 9 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
« no previous file with comments | « dart/frog/leg/scanner/scanner_task.dart ('k') | dart/frog/tests/leg/src/ResolverTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 visitClassNode(ClassNode node); 7 R visitClassNode(ClassNode node);
8 R visitExpressionStatement(ExpressionStatement node); 8 R visitExpressionStatement(ExpressionStatement node);
9 R visitFor(For node); 9 R visitFor(For node);
10 R visitFunctionExpression(FunctionExpression node); 10 R visitFunctionExpression(FunctionExpression node);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 } 63 }
64 64
65 abstract Token getBeginToken(); 65 abstract Token getBeginToken();
66 66
67 abstract Token getEndToken(); 67 abstract Token getEndToken();
68 } 68 }
69 69
70 class ClassNode extends Node { 70 class ClassNode extends Node {
71 final Identifier name; 71 final Identifier name;
72 final TypeAnnotation superclass;
73 final NodeList interfaces;
72 74
73 final Token beginToken; 75 final Token beginToken;
76 final Token extendsKeyword;
74 final Token endToken; 77 final Token endToken;
75 78
76 const ClassNode(this.name, this.beginToken, this.endToken); 79 const ClassNode(this.name, this.superclass, this.interfaces,
80 this.beginToken, this.extendsKeyword, this.endToken);
77 81
78 accept(Visitor visitor) => visitor.visitClassNode(this); 82 accept(Visitor visitor) => visitor.visitClassNode(this);
79 83
84 bool get isInterface() => beginToken.stringValue === 'interface';
85
86 bool get isClass() => !isInterface;
87
80 Token getBeginToken() => beginToken; 88 Token getBeginToken() => beginToken;
81 89
82 Token getEndToken() => endToken; 90 Token getEndToken() => endToken;
83 } 91 }
84 92
85 class Expression extends Node { 93 class Expression extends Node {
86 const Expression(); 94 const Expression();
87 } 95 }
88 96
89 class Statement extends Node { 97 class Statement extends Node {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 437 }
430 438
431 /** Representation of modifiers such as static, abstract, final, etc. */ 439 /** Representation of modifiers such as static, abstract, final, etc. */
432 class Modifiers { 440 class Modifiers {
433 final Link<Token> modifiers; 441 final Link<Token> modifiers;
434 /** Bit pattern to easy check what modifiers are present. */ 442 /** Bit pattern to easy check what modifiers are present. */
435 final int flags; 443 final int flags;
436 444
437 const Modifiers([this.modifiers, this.flags = 0]); 445 const Modifiers([this.modifiers, this.flags = 0]);
438 } 446 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/scanner_task.dart ('k') | dart/frog/tests/leg/src/ResolverTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698