Chromium Code Reviews| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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() { | |
|
ngeoffray
2012/02/16 11:23:50
Please file a bug, assign it to Peter, and add a T
karlklose
2012/02/17 13:35:00
Done.
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |