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

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 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 final Block block; 1584 final Block block;
1585 1585
1586 final catchKeyword; 1586 final catchKeyword;
1587 1587
1588 CatchBlock(this.formals, this.block, this.catchKeyword); 1588 CatchBlock(this.formals, this.block, this.catchKeyword);
1589 1589
1590 CatchBlock asCatchBlock() => this; 1590 CatchBlock asCatchBlock() => this;
1591 1591
1592 accept(Visitor visitor) => visitor.visitCatchBlock(this); 1592 accept(Visitor visitor) => visitor.visitCatchBlock(this);
1593 1593
1594 Node get exception() {
1595 VariableDefinitions declarations = formals.nodes.head;
ahe 2012/03/06 08:44:22 This may be null. The parser accepts: try {} catc
ngeoffray 2012/03/06 12:12:50 Done.
1596 return declarations.definitions.nodes.head;
1597 }
1598
1599 Node get trace() {
1600 Link<VariableDefinitions> declarations = formals.nodes.tail;
ahe 2012/03/06 08:44:22 See comment above.
ngeoffray 2012/03/06 12:12:50 Done.
1601 return declarations.isEmpty()
1602 ? null
1603 : declarations.head.definitions.nodes.head;
1604 }
1605
1594 visitChildren(Visitor visitor) { 1606 visitChildren(Visitor visitor) {
1595 formals.accept(visitor); 1607 formals.accept(visitor);
1596 block.accept(visitor); 1608 block.accept(visitor);
1597 } 1609 }
1598 1610
1599 Token getBeginToken() => catchKeyword; 1611 Token getBeginToken() => catchKeyword;
1600 1612
1601 Token getEndToken() => block.getEndToken(); 1613 Token getEndToken() => block.getEndToken();
1602 } 1614 }
1603 1615
(...skipping 11 matching lines...) Expand all
1615 static bool isConstructorRedirect(Send node) { 1627 static bool isConstructorRedirect(Send node) {
1616 return (node.receiver === null && 1628 return (node.receiver === null &&
1617 node.selector.asIdentifier() !== null && 1629 node.selector.asIdentifier() !== null &&
1618 node.selector.asIdentifier().isThis()) || 1630 node.selector.asIdentifier().isThis()) ||
1619 (node.receiver !== null && 1631 (node.receiver !== null &&
1620 node.receiver.asIdentifier() !== null && 1632 node.receiver.asIdentifier() !== null &&
1621 node.receiver.asIdentifier().isThis() && 1633 node.receiver.asIdentifier().isThis() &&
1622 node.selector.asIdentifier() !== null); 1634 node.selector.asIdentifier() !== null);
1623 } 1635 }
1624 } 1636 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698