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

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: 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
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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 436 }
429 437
430 /** Representation of modifiers such as static, abstract, final, etc. */ 438 /** Representation of modifiers such as static, abstract, final, etc. */
431 class Modifiers { 439 class Modifiers {
432 final Link<Token> modifiers; 440 final Link<Token> modifiers;
433 /** Bit pattern to easy check what modifiers are present. */ 441 /** Bit pattern to easy check what modifiers are present. */
434 final int flags; 442 final int flags;
435 443
436 const Modifiers([this.modifiers, this.flags = 0]); 444 const Modifiers([this.modifiers, this.flags = 0]);
437 } 445 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698