| OLD | NEW |
| 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 R visitNode(Node node); | 10 R visitNode(Node node); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 686 |
| 687 FunctionExpression(this.name, this.parameters, this.body, this.returnType, | 687 FunctionExpression(this.name, this.parameters, this.body, this.returnType, |
| 688 this.modifiers, this.initializers, this.getOrSet) { | 688 this.modifiers, this.initializers, this.getOrSet) { |
| 689 assert(modifiers != null); | 689 assert(modifiers != null); |
| 690 } | 690 } |
| 691 | 691 |
| 692 FunctionExpression asFunctionExpression() => this; | 692 FunctionExpression asFunctionExpression() => this; |
| 693 | 693 |
| 694 accept(Visitor visitor) => visitor.visitFunctionExpression(this); | 694 accept(Visitor visitor) => visitor.visitFunctionExpression(this); |
| 695 | 695 |
| 696 bool get isRedirectingFactory { |
| 697 return body != null && body.asReturn() != null && |
| 698 body.asReturn().isRedirectingFactoryBody; |
| 699 } |
| 700 |
| 696 visitChildren(Visitor visitor) { | 701 visitChildren(Visitor visitor) { |
| 697 if (modifiers != null) modifiers.accept(visitor); | 702 if (modifiers != null) modifiers.accept(visitor); |
| 698 if (returnType != null) returnType.accept(visitor); | 703 if (returnType != null) returnType.accept(visitor); |
| 699 if (name != null) name.accept(visitor); | 704 if (name != null) name.accept(visitor); |
| 700 if (parameters != null) parameters.accept(visitor); | 705 if (parameters != null) parameters.accept(visitor); |
| 701 if (initializers != null) initializers.accept(visitor); | 706 if (initializers != null) initializers.accept(visitor); |
| 702 if (body != null) body.accept(visitor); | 707 if (body != null) body.accept(visitor); |
| 703 } | 708 } |
| 704 | 709 |
| 705 bool hasBody() => body.asEmptyStatement() == null; | 710 bool hasBody() => body.asEmptyStatement() == null; |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 * argument). | 2067 * argument). |
| 2063 * | 2068 * |
| 2064 * TODO(ahe): This method is controversial, the team needs to discuss | 2069 * TODO(ahe): This method is controversial, the team needs to discuss |
| 2065 * if top-level methods are acceptable and what naming conventions to | 2070 * if top-level methods are acceptable and what naming conventions to |
| 2066 * use. | 2071 * use. |
| 2067 */ | 2072 */ |
| 2068 initializerDo(Node node, f(Node node)) { | 2073 initializerDo(Node node, f(Node node)) { |
| 2069 SendSet send = node.asSendSet(); | 2074 SendSet send = node.asSendSet(); |
| 2070 if (send != null) return f(send.arguments.head); | 2075 if (send != null) return f(send.arguments.head); |
| 2071 } | 2076 } |
| OLD | NEW |