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

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

Issue 10957060: First stab at parsing redirecting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Add test exceptions. Created 8 years, 2 months 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 abstract class Visitor<R> { 5 abstract class Visitor<R> {
6 const Visitor(); 6 const Visitor();
7 7
8 abstract R visitNode(Node node); 8 abstract R visitNode(Node node);
9 9
10 R visitBlock(Block node) => visitStatement(node); 10 R visitBlock(Block node) => visitStatement(node);
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 905
906 class Operator extends Identifier { 906 class Operator extends Identifier {
907 Operator(Token token) : super(token); 907 Operator(Token token) : super(token);
908 908
909 Operator asOperator() => this; 909 Operator asOperator() => this;
910 910
911 accept(Visitor visitor) => visitor.visitOperator(this); 911 accept(Visitor visitor) => visitor.visitOperator(this);
912 } 912 }
913 913
914 class Return extends Statement { 914 class Return extends Statement {
915 final Expression expression; 915 final Node expression;
916 final Token beginToken; 916 final Token beginToken;
917 final Token endToken; 917 final Token endToken;
918 918
919 Return(this.beginToken, this.endToken, this.expression); 919 Return(this.beginToken, this.endToken, this.expression);
920 920
921 Return asReturn() => this; 921 Return asReturn() => this;
922 922
923 bool get hasExpression => expression !== null; 923 bool get hasExpression => expression !== null;
924 924
925 bool get isRedirectingConstructorBody => beginToken.stringValue == '=';
926
925 accept(Visitor visitor) => visitor.visitReturn(this); 927 accept(Visitor visitor) => visitor.visitReturn(this);
926 928
927 visitChildren(Visitor visitor) { 929 visitChildren(Visitor visitor) {
928 if (expression !== null) expression.accept(visitor); 930 if (expression !== null) expression.accept(visitor);
929 } 931 }
930 932
931 Token getBeginToken() => beginToken; 933 Token getBeginToken() => beginToken;
932 934
933 Token getEndToken() { 935 Token getEndToken() {
934 if (endToken === null) return expression.getEndToken(); 936 if (endToken === null) return expression.getEndToken();
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 * argument). 1978 * argument).
1977 * 1979 *
1978 * TODO(ahe): This method is controversial, the team needs to discuss 1980 * TODO(ahe): This method is controversial, the team needs to discuss
1979 * if top-level methods are acceptable and what naming conventions to 1981 * if top-level methods are acceptable and what naming conventions to
1980 * use. 1982 * use.
1981 */ 1983 */
1982 initializerDo(Node node, f(Node node)) { 1984 initializerDo(Node node, f(Node node)) {
1983 SendSet send = node.asSendSet(); 1985 SendSet send = node.asSendSet();
1984 if (send !== null) return f(send.arguments.head); 1986 if (send !== null) return f(send.arguments.head);
1985 } 1987 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/parser.dart ('k') | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698