| OLD | NEW |
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 hashCode() => _hashCode; | 93 hashCode() => _hashCode; |
| 94 | 94 |
| 95 abstract accept(Visitor visitor); | 95 abstract accept(Visitor visitor); |
| 96 | 96 |
| 97 abstract visitChildren(Visitor visitor); | 97 abstract visitChildren(Visitor visitor); |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Returns this node unparsed to Dart source string. | 100 * Returns this node unparsed to Dart source string. |
| 101 */ | 101 */ |
| 102 toString() => unparse(); | 102 toString() => unparse(this); |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * Returns Xml-like tree representation of this node. | 105 * Returns Xml-like tree representation of this node. |
| 106 */ | 106 */ |
| 107 toDebugString() { | 107 toDebugString() { |
| 108 return PrettyPrinter.prettyPrint(this); | 108 return PrettyPrinter.prettyPrint(this); |
| 109 } | 109 } |
| 110 | 110 |
| 111 String getObjectDescription() => super.toString(); | 111 String getObjectDescription() => super.toString(); |
| 112 | 112 |
| 113 String unparse() { | |
| 114 Unparser unparser = new Unparser(); | |
| 115 try { | |
| 116 return unparser.unparse(this); | |
| 117 } catch (e, trace) { | |
| 118 print(trace); | |
| 119 return '<<unparse error: ${getObjectDescription()}: ${unparser.sb}>>'; | |
| 120 } | |
| 121 } | |
| 122 | |
| 123 abstract Token getBeginToken(); | 113 abstract Token getBeginToken(); |
| 124 | 114 |
| 125 abstract Token getEndToken(); | 115 abstract Token getEndToken(); |
| 126 | 116 |
| 127 Block asBlock() => null; | 117 Block asBlock() => null; |
| 128 BreakStatement asBreakStatement() => null; | 118 BreakStatement asBreakStatement() => null; |
| 129 Cascade asCascade() => null; | 119 Cascade asCascade() => null; |
| 130 CascadeReceiver asCascadeReceiver() => null; | 120 CascadeReceiver asCascadeReceiver() => null; |
| 131 CaseMatch asCaseMatch() => null; | 121 CaseMatch asCaseMatch() => null; |
| 132 CatchBlock asCatchBlock() => null; | 122 CatchBlock asCatchBlock() => null; |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 * argument). | 1751 * argument). |
| 1762 * | 1752 * |
| 1763 * TODO(ahe): This method is controversial, the team needs to discuss | 1753 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1764 * if top-level methods are acceptable and what naming conventions to | 1754 * if top-level methods are acceptable and what naming conventions to |
| 1765 * use. | 1755 * use. |
| 1766 */ | 1756 */ |
| 1767 initializerDo(Node node, f(Node node)) { | 1757 initializerDo(Node node, f(Node node)) { |
| 1768 SendSet send = node.asSendSet(); | 1758 SendSet send = node.asSendSet(); |
| 1769 if (send !== null) return f(send.arguments.head); | 1759 if (send !== null) return f(send.arguments.head); |
| 1770 } | 1760 } |
| OLD | NEW |