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

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

Issue 9109015: AST nodes for function-typed parameters. (Closed) Base URL: ssh://aaricia.aar/home/ahe/Dart/all/dart.googlecode.com.git@master
Patch Set: rebased 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
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/frog/leg/tree/unparser.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 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 abstract visitChildren(Visitor visitor); 76 abstract visitChildren(Visitor visitor);
77 77
78 toString() => unparse(); 78 toString() => unparse();
79 79
80 String getObjectDescription() => super.toString(); 80 String getObjectDescription() => super.toString();
81 81
82 String unparse() { 82 String unparse() {
83 Unparser unparser = new Unparser(); 83 Unparser unparser = new Unparser();
84 try { 84 try {
85 return unparser.unparse(this); 85 return unparser.unparse(this);
86 } catch (var e) { 86 } catch (var e, var trace) {
87 print(trace);
87 return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>'; 88 return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>';
88 } 89 }
89 } 90 }
90 91
91 abstract Token getBeginToken(); 92 abstract Token getBeginToken();
92 93
93 abstract Token getEndToken(); 94 abstract Token getEndToken();
94 95
95 Block asBlock() => null; 96 Block asBlock() => null;
96 BreakStatement asBreakStatement() => null; 97 BreakStatement asBreakStatement() => null;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 if (name !== null) name.accept(visitor); 517 if (name !== null) name.accept(visitor);
517 if (parameters !== null) parameters.accept(visitor); 518 if (parameters !== null) parameters.accept(visitor);
518 if (body !== null) body.accept(visitor); 519 if (body !== null) body.accept(visitor);
519 if (returnType !== null) returnType.accept(visitor); 520 if (returnType !== null) returnType.accept(visitor);
520 } 521 }
521 522
522 Token getBeginToken() { 523 Token getBeginToken() {
523 return firstBeginToken(returnType, name); 524 return firstBeginToken(returnType, name);
524 } 525 }
525 526
526 Token getEndToken() => body.getEndToken(); 527 Token getEndToken() {
528 return (body === null) ? parameters.getEndToken() : body.getEndToken();
529 }
527 } 530 }
528 531
529 typedef void DecodeErrorHandler(Token token, var error); 532 typedef void DecodeErrorHandler(Token token, var error);
530 533
531 class Literal<T> extends Expression { 534 class Literal<T> extends Expression {
532 final Token token; 535 final Token token;
533 final DecodeErrorHandler handler; 536 final DecodeErrorHandler handler;
534 537
535 Literal(Token this.token, DecodeErrorHandler this.handler); 538 Literal(Token this.token, DecodeErrorHandler this.handler);
536 539
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 1229
1227 visitChildren(Visitor visitor) { 1230 visitChildren(Visitor visitor) {
1228 formals.accept(visitor); 1231 formals.accept(visitor);
1229 block.accept(visitor); 1232 block.accept(visitor);
1230 } 1233 }
1231 1234
1232 Token getBeginToken() => catchKeyword; 1235 Token getBeginToken() => catchKeyword;
1233 1236
1234 Token getEndToken() => block.getEndToken(); 1237 Token getEndToken() => block.getEndToken();
1235 } 1238 }
OLDNEW
« no previous file with comments | « dart/frog/leg/scanner/listener.dart ('k') | dart/frog/leg/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698