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

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

Issue 9241014: Generate AST nodes for field initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes Created 8 years, 11 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
« no previous file with comments | « dart/frog/leg/scanner/scanner_task.dart ('k') | dart/tests/corelib/corelib-leg.status » ('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 visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCatchBlock(CatchBlock node); 8 R visitCatchBlock(CatchBlock node);
9 R visitClassNode(ClassNode node); 9 R visitClassNode(ClassNode node);
10 R visitConditional(Conditional node); 10 R visitConditional(Conditional node);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 accept(Visitor visitor) => visitor.visitFunctionExpression(this); 529 accept(Visitor visitor) => visitor.visitFunctionExpression(this);
530 530
531 visitChildren(Visitor visitor) { 531 visitChildren(Visitor visitor) {
532 if (name !== null) name.accept(visitor); 532 if (name !== null) name.accept(visitor);
533 if (parameters !== null) parameters.accept(visitor); 533 if (parameters !== null) parameters.accept(visitor);
534 if (body !== null) body.accept(visitor); 534 if (body !== null) body.accept(visitor);
535 if (returnType !== null) returnType.accept(visitor); 535 if (returnType !== null) returnType.accept(visitor);
536 } 536 }
537 537
538 Token getBeginToken() { 538 Token getBeginToken() {
539 return firstBeginToken(returnType, name); 539 if (returnType === null) return firstBeginToken(name, parameters);
540 return returnType.getBeginToken();
540 } 541 }
541 542
542 Token getEndToken() { 543 Token getEndToken() {
543 return (body === null) ? parameters.getEndToken() : body.getEndToken(); 544 return (body === null) ? parameters.getEndToken() : body.getEndToken();
544 } 545 }
545 } 546 }
546 547
547 typedef void DecodeErrorHandler(Token token, var error); 548 typedef void DecodeErrorHandler(Token token, var error);
548 549
549 class Literal<T> extends Expression { 550 class Literal<T> extends Expression {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 bool get hasExpression() => expression !== null; 702 bool get hasExpression() => expression !== null;
702 703
703 accept(Visitor visitor) => visitor.visitReturn(this); 704 accept(Visitor visitor) => visitor.visitReturn(this);
704 705
705 visitChildren(Visitor visitor) { 706 visitChildren(Visitor visitor) {
706 if (expression !== null) expression.accept(visitor); 707 if (expression !== null) expression.accept(visitor);
707 } 708 }
708 709
709 Token getBeginToken() => beginToken; 710 Token getBeginToken() => beginToken;
710 711
711 Token getEndToken() => endToken; 712 Token getEndToken() {
713 if (endToken === null) return expression.getEndToken();
714 return endToken;
715 }
712 } 716 }
713 717
714 class ExpressionStatement extends Statement { 718 class ExpressionStatement extends Statement {
715 final Expression expression; 719 final Expression expression;
716 final Token endToken; 720 final Token endToken;
717 721
718 ExpressionStatement(this.expression, this.endToken); 722 ExpressionStatement(this.expression, this.endToken);
719 723
720 ExpressionStatement asExpressionStatement() => this; 724 ExpressionStatement asExpressionStatement() => this;
721 725
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1255
1252 visitChildren(Visitor visitor) { 1256 visitChildren(Visitor visitor) {
1253 formals.accept(visitor); 1257 formals.accept(visitor);
1254 block.accept(visitor); 1258 block.accept(visitor);
1255 } 1259 }
1256 1260
1257 Token getBeginToken() => catchKeyword; 1261 Token getBeginToken() => catchKeyword;
1258 1262
1259 Token getEndToken() => block.getEndToken(); 1263 Token getEndToken() => block.getEndToken();
1260 } 1264 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/scanner_task.dart ('k') | dart/tests/corelib/corelib-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698