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

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

Issue 9391004: Implement cycle-checking and code generation for redirecting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 10 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 | « frog/leg/ssa/builder.dart ('k') | frog/leg/warnings.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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 529
530 accept(Visitor visitor) => visitor.visitFunctionExpression(this); 530 accept(Visitor visitor) => visitor.visitFunctionExpression(this);
531 531
532 visitChildren(Visitor visitor) { 532 visitChildren(Visitor visitor) {
533 if (name !== null) name.accept(visitor); 533 if (name !== null) name.accept(visitor);
534 if (parameters !== null) parameters.accept(visitor); 534 if (parameters !== null) parameters.accept(visitor);
535 if (body !== null) body.accept(visitor); 535 if (body !== null) body.accept(visitor);
536 if (returnType !== null) returnType.accept(visitor); 536 if (returnType !== null) returnType.accept(visitor);
537 } 537 }
538 538
539 bool hasBody() {
540 // TODO(karlklose,ahe): refactor AST nodes (issue 1713).
541 if (body.asReturn() !== null) return true;
542 NodeList statements = body.asBlock().statements;
543 return (!statements.nodes.isEmpty() ||
544 statements.getBeginToken().kind !== $SEMICOLON);
545 }
546
539 Token getBeginToken() { 547 Token getBeginToken() {
540 Token token = firstBeginToken(modifiers, returnType); 548 Token token = firstBeginToken(modifiers, returnType);
541 if (token !== null) return token; 549 if (token !== null) return token;
542 if (getOrSet !== null) return getOrSet; 550 if (getOrSet !== null) return getOrSet;
543 return firstBeginToken(name, parameters); 551 return firstBeginToken(name, parameters);
544 } 552 }
545 553
546 Token getEndToken() { 554 Token getEndToken() {
547 return (body === null) ? parameters.getEndToken() : body.getEndToken(); 555 return (body === null) ? parameters.getEndToken() : body.getEndToken();
548 } 556 }
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 static bool isConstructorRedirect(Send node) { 1483 static bool isConstructorRedirect(Send node) {
1476 return (node.receiver === null && 1484 return (node.receiver === null &&
1477 node.selector.asIdentifier() !== null && 1485 node.selector.asIdentifier() !== null &&
1478 node.selector.asIdentifier().isThis()) || 1486 node.selector.asIdentifier().isThis()) ||
1479 (node.receiver !== null && 1487 (node.receiver !== null &&
1480 node.receiver.asIdentifier() !== null && 1488 node.receiver.asIdentifier() !== null &&
1481 node.receiver.asIdentifier().isThis() && 1489 node.receiver.asIdentifier().isThis() &&
1482 node.selector.asIdentifier() !== null); 1490 node.selector.asIdentifier() !== null);
1483 } 1491 }
1484 } 1492 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/leg/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698