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

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

Issue 9004025: Parse field modifiers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleaned up for commit Created 9 years 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/parser.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 visitConditional(Conditional node); 8 R visitConditional(Conditional node);
9 R visitDoWhile(DoWhile node); 9 R visitDoWhile(DoWhile node);
10 R visitExpressionStatement(ExpressionStatement node); 10 R visitExpressionStatement(ExpressionStatement node);
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 if (expression !== null) expression.accept(visitor); 784 if (expression !== null) expression.accept(visitor);
785 } 785 }
786 786
787 Token getBeginToken() => beginToken; 787 Token getBeginToken() => beginToken;
788 788
789 Token getEndToken() => beginToken.endGroup; 789 Token getEndToken() => beginToken.endGroup;
790 } 790 }
791 791
792 /** Representation of modifiers such as static, abstract, final, etc. */ 792 /** Representation of modifiers such as static, abstract, final, etc. */
793 class Modifiers extends Node { 793 class Modifiers extends Node {
794 /* TODO(ahe): The following should be validated relating to modifiers:
795 * 1. The nodes must come in a certain order.
796 * 2. The keywords "var" and "final" may not be used at the same time.
797 * 3. The type of an element must be null if isVar() is true.
798 */
799
794 final NodeList nodes; 800 final NodeList nodes;
795 /** Bit pattern to easy check what modifiers are present. */ 801 /** Bit pattern to easy check what modifiers are present. */
796 final int flags; 802 final int flags;
797 803
798 static final int FLAG_STATIC = 1; 804 static final int FLAG_STATIC = 1;
799 static final int FLAG_ABSTRACT = FLAG_STATIC << 1; 805 static final int FLAG_ABSTRACT = FLAG_STATIC << 1;
800 static final int FLAG_FINAL = FLAG_ABSTRACT << 1; 806 static final int FLAG_FINAL = FLAG_ABSTRACT << 1;
801 static final int FLAG_VAR = FLAG_FINAL << 1; 807 static final int FLAG_VAR = FLAG_FINAL << 1;
802 static final int FLAG_CONST = FLAG_VAR << 1; 808 static final int FLAG_CONST = FLAG_VAR << 1;
803 809
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 896
891 UnimplementedStatement(this.description, List<Node> nodes) 897 UnimplementedStatement(this.description, List<Node> nodes)
892 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes)); 898 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes));
893 899
894 toString() => '$description($nodes)'; 900 toString() => '$description($nodes)';
895 901
896 Token getBeginToken() => nodes.getBeginToken(); 902 Token getBeginToken() => nodes.getBeginToken();
897 903
898 Token getEndToken() => nodes.getEndToken(); 904 Token getEndToken() => nodes.getEndToken();
899 } 905 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/parser.dart ('k') | dart/frog/tests/leg/src/ResolverTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698