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

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

Issue 8497011: Parse formal parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased, frogsh, type warning 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
« no previous file with comments | « dart/frog/leg/ssa/builder.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 visitExpressionStatement(ExpressionStatement node); 7 R visitExpressionStatement(ExpressionStatement node);
8 R visitFunctionExpression(FunctionExpression node); 8 R visitFunctionExpression(FunctionExpression node);
9 R visitIdentifier(Identifier node); 9 R visitIdentifier(Identifier node);
10 R visitIf(If node); 10 R visitIf(If node);
11 R visitLiteralBool(LiteralBool node); 11 R visitLiteralBool(LiteralBool node);
12 R visitLiteralDouble(LiteralDouble node); 12 R visitLiteralDouble(LiteralDouble node);
13 R visitLiteralInt(LiteralInt node); 13 R visitLiteralInt(LiteralInt node);
14 R visitLiteralString(LiteralString node); 14 R visitLiteralString(LiteralString node);
15 R visitNodeList(NodeList node); 15 R visitNodeList(NodeList node);
16 R visitOperator(Operator node); 16 R visitOperator(Operator node);
17 R visitParameter(Parameter node);
18 R visitReturn(Return node); 17 R visitReturn(Return node);
19 R visitSend(Send node); 18 R visitSend(Send node);
20 R visitSendSet(SendSet node); 19 R visitSendSet(SendSet node);
21 R visitTypeAnnotation(TypeAnnotation node); 20 R visitTypeAnnotation(TypeAnnotation node);
22 R visitVariableDefinitions(VariableDefinitions node); 21 R visitVariableDefinitions(VariableDefinitions node);
23 } 22 }
24 23
25 Token firstBeginToken(Node first, Node second) { 24 Token firstBeginToken(Node first, Node second) {
26 return (first !== null) ? first.getBeginToken() 25 return (first !== null) ? first.getBeginToken()
27 : second.getBeginToken(); 26 : second.getBeginToken();
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 305
307 getEndToken() => token; 306 getEndToken() => token;
308 } 307 }
309 308
310 class Operator extends Identifier { 309 class Operator extends Identifier {
311 const Operator(Token token) : super(token); 310 const Operator(Token token) : super(token);
312 311
313 accept(Visitor visitor) => visitor.visitOperator(this); 312 accept(Visitor visitor) => visitor.visitOperator(this);
314 } 313 }
315 314
316 class Parameter extends Node {
317 final Identifier name;
318 final TypeAnnotation typeAnnotation;
319
320 const Parameter(this.name, [this.typeAnnotation]);
321
322 accept(Visitor visitor) => visitor.visitParameter(this);
323
324 Token getBeginToken() {
325 return firstBeginToken(typeAnnotation, name);
326 }
327
328 Token getEndToken() => name.getEndToken();
329 }
330
331 class Return extends Statement { 315 class Return extends Statement {
332 final Expression expression; 316 final Expression expression;
333 final Token beginToken; 317 final Token beginToken;
334 final Token endToken; 318 final Token endToken;
335 319
336 const Return(this.beginToken, this.endToken, this.expression); 320 const Return(this.beginToken, this.endToken, this.expression);
337 321
338 bool get hasExpression() => expression !== null; 322 bool get hasExpression() => expression !== null;
339 323
340 accept(Visitor visitor) => visitor.visitReturn(this); 324 accept(Visitor visitor) => visitor.visitReturn(this);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 369 }
386 370
387 /** Representation of modifiers such as static, abstract, final, etc. */ 371 /** Representation of modifiers such as static, abstract, final, etc. */
388 class Modifiers { 372 class Modifiers {
389 final Link<Token> modifiers; 373 final Link<Token> modifiers;
390 /** Bit pattern to easy check what modifiers are present. */ 374 /** Bit pattern to easy check what modifiers are present. */
391 final int flags; 375 final int flags;
392 376
393 const Modifiers([this.modifiers, this.flags = 0]); 377 const Modifiers([this.modifiers, this.flags = 0]);
394 } 378 }
OLDNEW
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/leg/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698