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

Side by Side Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10905203: Allow catch part to be optional as in try {} on T [catch (x[,y])] {} (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 8 years, 3 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) 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 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 visitCascade(Cascade node); 8 R visitCascade(Cascade node);
9 R visitCascadeReceiver(CascadeReceiver node); 9 R visitCascadeReceiver(CascadeReceiver node);
10 R visitCaseMatch(CaseMatch node); 10 R visitCaseMatch(CaseMatch node);
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 final Token catchKeyword; 1695 final Token catchKeyword;
1696 1696
1697 CatchBlock(this.type, this.formals, this.block, 1697 CatchBlock(this.type, this.formals, this.block,
1698 this.onKeyword, this.catchKeyword); 1698 this.onKeyword, this.catchKeyword);
1699 1699
1700 CatchBlock asCatchBlock() => this; 1700 CatchBlock asCatchBlock() => this;
1701 1701
1702 accept(Visitor visitor) => visitor.visitCatchBlock(this); 1702 accept(Visitor visitor) => visitor.visitCatchBlock(this);
1703 1703
1704 Node get exception { 1704 Node get exception {
1705 if (formals.nodes.isEmpty()) return null; 1705 if (formals === null || formals.nodes.isEmpty()) return null;
1706 VariableDefinitions declarations = formals.nodes.head; 1706 VariableDefinitions declarations = formals.nodes.head;
1707 return declarations.definitions.nodes.head; 1707 return declarations.definitions.nodes.head;
1708 } 1708 }
1709 1709
1710 Node get trace { 1710 Node get trace {
1711 if (formals.nodes.isEmpty()) return null; 1711 if (formals === null || formals.nodes.isEmpty()) return null;
1712 Link<Node> declarations = formals.nodes.tail; 1712 Link<Node> declarations = formals.nodes.tail;
1713 if (declarations.isEmpty()) return null; 1713 if (declarations.isEmpty()) return null;
1714 VariableDefinitions head = declarations.head; 1714 VariableDefinitions head = declarations.head;
1715 return head.definitions.nodes.head; 1715 return head.definitions.nodes.head;
1716 } 1716 }
1717 1717
1718 visitChildren(Visitor visitor) { 1718 visitChildren(Visitor visitor) {
1719 if (type != null) type.accept(visitor); 1719 if (type !== null) type.accept(visitor);
1720 formals.accept(visitor); 1720 if (formals !== null) formals.accept(visitor);
1721 block.accept(visitor); 1721 block.accept(visitor);
1722 } 1722 }
1723 1723
1724 Token getBeginToken() => onKeyword != null ? onKeyword : catchKeyword; 1724 Token getBeginToken() => onKeyword != null ? onKeyword : catchKeyword;
1725 1725
1726 Token getEndToken() => block.getEndToken(); 1726 Token getEndToken() => block.getEndToken();
1727 } 1727 }
1728 1728
1729 class Initializers { 1729 class Initializers {
1730 static bool isSuperConstructorCall(Send node) { 1730 static bool isSuperConstructorCall(Send node) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 * argument). 1769 * argument).
1770 * 1770 *
1771 * TODO(ahe): This method is controversial, the team needs to discuss 1771 * TODO(ahe): This method is controversial, the team needs to discuss
1772 * if top-level methods are acceptable and what naming conventions to 1772 * if top-level methods are acceptable and what naming conventions to
1773 * use. 1773 * use.
1774 */ 1774 */
1775 initializerDo(Node node, f(Node node)) { 1775 initializerDo(Node node, f(Node node)) {
1776 SendSet send = node.asSendSet(); 1776 SendSet send = node.asSendSet();
1777 if (send !== null) return f(send.arguments.head); 1777 if (send !== null) return f(send.arguments.head);
1778 } 1778 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698