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

Side by Side Diff: dart/lib/compiler/implementation/tree/nodes.dart

Issue 11348037: A method or accessor with empty body is implicitly abstract. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Changes to make unit tests pass Created 8 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/lib/compiler/implementation/ssa/builder.dart ('k') | dart/tests/co19/co19-dart2js.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of tree; 5 part of tree;
6 6
7 abstract class Visitor<R> { 7 abstract class Visitor<R> {
8 const Visitor(); 8 const Visitor();
9 9
10 abstract R visitNode(Node node); 10 abstract R visitNode(Node node);
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 628
629 visitChildren(Visitor visitor) { 629 visitChildren(Visitor visitor) {
630 if (modifiers != null) modifiers.accept(visitor); 630 if (modifiers != null) modifiers.accept(visitor);
631 if (returnType != null) returnType.accept(visitor); 631 if (returnType != null) returnType.accept(visitor);
632 if (name != null) name.accept(visitor); 632 if (name != null) name.accept(visitor);
633 if (parameters != null) parameters.accept(visitor); 633 if (parameters != null) parameters.accept(visitor);
634 if (initializers != null) initializers.accept(visitor); 634 if (initializers != null) initializers.accept(visitor);
635 if (body != null) body.accept(visitor); 635 if (body != null) body.accept(visitor);
636 } 636 }
637 637
638 bool hasBody() { 638 bool hasBody() => body.asEmptyStatement() == null;
639 // TODO(karlklose,ahe): refactor AST nodes (issue 1713). 639
640 if (body.asReturn() != null) return true; 640 bool hasEmptyBody() {
641 NodeList statements = body.asBlock().statements; 641 Block block = body.asBlock();
642 return (!statements.nodes.isEmpty || 642 if (block == null) return false;
643 !identical(statements.getBeginToken().kind, $SEMICOLON)); 643 return block.statements.isEmpty;
644 } 644 }
645 645
646 Token getBeginToken() { 646 Token getBeginToken() {
647 Token token = firstBeginToken(modifiers, returnType); 647 Token token = firstBeginToken(modifiers, returnType);
648 if (token != null) return token; 648 if (token != null) return token;
649 if (getOrSet != null) return getOrSet; 649 if (getOrSet != null) return getOrSet;
650 return firstBeginToken(name, parameters); 650 return firstBeginToken(name, parameters);
651 } 651 }
652 652
653 Token getEndToken() { 653 Token getEndToken() {
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 * argument). 1995 * argument).
1996 * 1996 *
1997 * TODO(ahe): This method is controversial, the team needs to discuss 1997 * TODO(ahe): This method is controversial, the team needs to discuss
1998 * if top-level methods are acceptable and what naming conventions to 1998 * if top-level methods are acceptable and what naming conventions to
1999 * use. 1999 * use.
2000 */ 2000 */
2001 initializerDo(Node node, f(Node node)) { 2001 initializerDo(Node node, f(Node node)) {
2002 SendSet send = node.asSendSet(); 2002 SendSet send = node.asSendSet();
2003 if (send != null) return f(send.arguments.head); 2003 if (send != null) return f(send.arguments.head);
2004 } 2004 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/ssa/builder.dart ('k') | dart/tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698