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

Side by Side Diff: frog/leg/tree/nodes.dart

Issue 9601014: Support for stack traces in catch blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 final Block block; 1653 final Block block;
1654 1654
1655 final catchKeyword; 1655 final catchKeyword;
1656 1656
1657 CatchBlock(this.formals, this.block, this.catchKeyword); 1657 CatchBlock(this.formals, this.block, this.catchKeyword);
1658 1658
1659 CatchBlock asCatchBlock() => this; 1659 CatchBlock asCatchBlock() => this;
1660 1660
1661 accept(Visitor visitor) => visitor.visitCatchBlock(this); 1661 accept(Visitor visitor) => visitor.visitCatchBlock(this);
1662 1662
1663 Node get exception() {
1664 if (formals.nodes.isEmpty()) return null;
ahe 2012/03/06 12:24:07 Perhaps you should check if this returns null in t
ngeoffray 2012/03/06 12:29:40 It's already doing it.
1665 VariableDefinitions declarations = formals.nodes.head;
1666 return declarations.definitions.nodes.head;
1667 }
1668
1669 Node get trace() {
1670 if (formals.nodes.isEmpty()) return null;
1671 Link<VariableDefinitions> declarations = formals.nodes.tail;
1672 return declarations.isEmpty()
1673 ? null
1674 : declarations.head.definitions.nodes.head;
1675 }
1676
1663 visitChildren(Visitor visitor) { 1677 visitChildren(Visitor visitor) {
1664 formals.accept(visitor); 1678 formals.accept(visitor);
1665 block.accept(visitor); 1679 block.accept(visitor);
1666 } 1680 }
1667 1681
1668 Token getBeginToken() => catchKeyword; 1682 Token getBeginToken() => catchKeyword;
1669 1683
1670 Token getEndToken() => block.getEndToken(); 1684 Token getEndToken() => block.getEndToken();
1671 } 1685 }
1672 1686
(...skipping 11 matching lines...) Expand all
1684 static bool isConstructorRedirect(Send node) { 1698 static bool isConstructorRedirect(Send node) {
1685 return (node.receiver === null && 1699 return (node.receiver === null &&
1686 node.selector.asIdentifier() !== null && 1700 node.selector.asIdentifier() !== null &&
1687 node.selector.asIdentifier().isThis()) || 1701 node.selector.asIdentifier().isThis()) ||
1688 (node.receiver !== null && 1702 (node.receiver !== null &&
1689 node.receiver.asIdentifier() !== null && 1703 node.receiver.asIdentifier() !== null &&
1690 node.receiver.asIdentifier().isThis() && 1704 node.receiver.asIdentifier().isThis() &&
1691 node.selector.asIdentifier() !== null); 1705 node.selector.asIdentifier() !== null);
1692 } 1706 }
1693 } 1707 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698