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

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 and add a test. 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
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 524
525 accept(Visitor visitor) => visitor.visitFunctionExpression(this); 525 accept(Visitor visitor) => visitor.visitFunctionExpression(this);
526 526
527 visitChildren(Visitor visitor) { 527 visitChildren(Visitor visitor) {
528 if (name !== null) name.accept(visitor); 528 if (name !== null) name.accept(visitor);
529 if (parameters !== null) parameters.accept(visitor); 529 if (parameters !== null) parameters.accept(visitor);
530 if (body !== null) body.accept(visitor); 530 if (body !== null) body.accept(visitor);
531 if (returnType !== null) returnType.accept(visitor); 531 if (returnType !== null) returnType.accept(visitor);
532 } 532 }
533 533
534 bool hasBody() {
535 if (body.asReturn() !== null) return true;
536 NodeList statements = body.asBlock().statements;
537 return (!statements.nodes.isEmpty() ||
538 statements.getBeginToken().kind !== $SEMICOLON);
539 }
540
534 Token getBeginToken() { 541 Token getBeginToken() {
535 Token token = firstBeginToken(modifiers, returnType); 542 Token token = firstBeginToken(modifiers, returnType);
536 if (token !== null) return token; 543 if (token !== null) return token;
537 if (getOrSet !== null) return getOrSet; 544 if (getOrSet !== null) return getOrSet;
538 return firstBeginToken(name, parameters); 545 return firstBeginToken(name, parameters);
539 } 546 }
540 547
541 Token getEndToken() { 548 Token getEndToken() {
542 return (body === null) ? parameters.getEndToken() : body.getEndToken(); 549 return (body === null) ? parameters.getEndToken() : body.getEndToken();
543 } 550 }
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 static bool isConstructorRedirect(Send node) { 1473 static bool isConstructorRedirect(Send node) {
1467 return (node.receiver === null && 1474 return (node.receiver === null &&
1468 node.selector.asIdentifier() !== null && 1475 node.selector.asIdentifier() !== null &&
1469 node.selector.asIdentifier().isThis()) || 1476 node.selector.asIdentifier().isThis()) ||
1470 (node.receiver !== null && 1477 (node.receiver !== null &&
1471 node.receiver.asIdentifier() !== null && 1478 node.receiver.asIdentifier() !== null &&
1472 node.receiver.asIdentifier().isThis() && 1479 node.receiver.asIdentifier().isThis() &&
1473 node.selector.asIdentifier() !== null); 1480 node.selector.asIdentifier() !== null);
1474 } 1481 }
1475 } 1482 }
OLDNEW
« frog/leg/resolver.dart ('K') | « 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