| OLD | NEW |
| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 final Token getOrSet; | 545 final Token getOrSet; |
| 546 | 546 |
| 547 FunctionExpression(this.name, this.parameters, this.body, this.returnType, | 547 FunctionExpression(this.name, this.parameters, this.body, this.returnType, |
| 548 this.modifiers, this.initializers, this.getOrSet); | 548 this.modifiers, this.initializers, this.getOrSet); |
| 549 | 549 |
| 550 FunctionExpression asFunctionExpression() => this; | 550 FunctionExpression asFunctionExpression() => this; |
| 551 | 551 |
| 552 accept(Visitor visitor) => visitor.visitFunctionExpression(this); | 552 accept(Visitor visitor) => visitor.visitFunctionExpression(this); |
| 553 | 553 |
| 554 visitChildren(Visitor visitor) { | 554 visitChildren(Visitor visitor) { |
| 555 if (modifiers !== null) modifiers.accept(visitor); |
| 556 if (returnType !== null) returnType.accept(visitor); |
| 555 if (name !== null) name.accept(visitor); | 557 if (name !== null) name.accept(visitor); |
| 556 if (parameters !== null) parameters.accept(visitor); | 558 if (parameters !== null) parameters.accept(visitor); |
| 559 if (initializers !== null) initializers.accept(visitor); |
| 557 if (body !== null) body.accept(visitor); | 560 if (body !== null) body.accept(visitor); |
| 558 if (returnType !== null) returnType.accept(visitor); | |
| 559 } | 561 } |
| 560 | 562 |
| 561 bool hasBody() { | 563 bool hasBody() { |
| 562 // TODO(karlklose,ahe): refactor AST nodes (issue 1713). | 564 // TODO(karlklose,ahe): refactor AST nodes (issue 1713). |
| 563 if (body.asReturn() !== null) return true; | 565 if (body.asReturn() !== null) return true; |
| 564 NodeList statements = body.asBlock().statements; | 566 NodeList statements = body.asBlock().statements; |
| 565 return (!statements.nodes.isEmpty() || | 567 return (!statements.nodes.isEmpty() || |
| 566 statements.getBeginToken().kind !== $SEMICOLON); | 568 statements.getBeginToken().kind !== $SEMICOLON); |
| 567 } | 569 } |
| 568 | 570 |
| (...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 static bool isConstructorRedirect(Send node) { | 1702 static bool isConstructorRedirect(Send node) { |
| 1701 return (node.receiver === null && | 1703 return (node.receiver === null && |
| 1702 node.selector.asIdentifier() !== null && | 1704 node.selector.asIdentifier() !== null && |
| 1703 node.selector.asIdentifier().isThis()) || | 1705 node.selector.asIdentifier().isThis()) || |
| 1704 (node.receiver !== null && | 1706 (node.receiver !== null && |
| 1705 node.receiver.asIdentifier() !== null && | 1707 node.receiver.asIdentifier() !== null && |
| 1706 node.receiver.asIdentifier().isThis() && | 1708 node.receiver.asIdentifier().isThis() && |
| 1707 node.selector.asIdentifier() !== null); | 1709 node.selector.asIdentifier() !== null); |
| 1708 } | 1710 } |
| 1709 } | 1711 } |
| OLD | NEW |