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

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

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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 String unparse(Node node) { 5 String unparse(Node node) {
6 Unparser unparser = new Unparser(); 6 Unparser unparser = new Unparser();
7 unparser.unparse(node); 7 unparser.unparse(node);
8 return unparser.result; 8 return unparser.result;
9 } 9 }
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 visit(node.name); 54 visit(node.name);
55 if (node.typeParameters != null) { 55 if (node.typeParameters != null) {
56 visit(node.typeParameters); 56 visit(node.typeParameters);
57 } 57 }
58 if (node.extendsKeyword != null) { 58 if (node.extendsKeyword != null) {
59 sb.add(' '); 59 sb.add(' ');
60 addToken(node.extendsKeyword); 60 addToken(node.extendsKeyword);
61 visit(node.superclass); 61 visit(node.superclass);
62 } 62 }
63 if (!node.interfaces.isEmpty()) { 63 if (!node.interfaces.isEmpty) {
64 sb.add(' '); 64 sb.add(' ');
65 visit(node.interfaces); 65 visit(node.interfaces);
66 } 66 }
67 if (node.defaultClause != null) { 67 if (node.defaultClause != null) {
68 sb.add(' default '); 68 sb.add(' default ');
69 visit(node.defaultClause); 69 visit(node.defaultClause);
70 } 70 }
71 sb.add('{'); 71 sb.add('{');
72 for (final member in members) { 72 for (final member in members) {
73 visit(member); 73 visit(member);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 visitNewExpression(NewExpression node) { 199 visitNewExpression(NewExpression node) {
200 addToken(node.newToken); 200 addToken(node.newToken);
201 visit(node.send); 201 visit(node.send);
202 } 202 }
203 203
204 visitLiteralList(LiteralList node) { 204 visitLiteralList(LiteralList node) {
205 if (node.constKeyword != null) add(node.constKeyword.value); 205 if (node.constKeyword != null) add(node.constKeyword.value);
206 visit(node.typeArguments); 206 visit(node.typeArguments);
207 visit(node.elements); 207 visit(node.elements);
208 // If list is empty, emit space after [] to disambiguate cases like []==[]. 208 // If list is empty, emit space after [] to disambiguate cases like []==[].
209 if (node.elements.isEmpty()) sb.add(' '); 209 if (node.elements.isEmpty) sb.add(' ');
210 } 210 }
211 211
212 visitModifiers(Modifiers node) => node.visitChildren(this); 212 visitModifiers(Modifiers node) => node.visitChildren(this);
213 213
214 /** 214 /**
215 * Unparses given NodeList starting from specific node. 215 * Unparses given NodeList starting from specific node.
216 */ 216 */
217 unparseNodeListFrom(NodeList node, Link<Node> from) { 217 unparseNodeListFrom(NodeList node, Link<Node> from) {
218 if (from.isEmpty()) return; 218 if (from.isEmpty) return;
219 String delimiter = (node.delimiter == null) ? "" : "${node.delimiter}"; 219 String delimiter = (node.delimiter == null) ? "" : "${node.delimiter}";
220 visit(from.head); 220 visit(from.head);
221 for (Link link = from.tail; !link.isEmpty(); link = link.tail) { 221 for (Link link = from.tail; !link.isEmpty; link = link.tail) {
222 sb.add(delimiter); 222 sb.add(delimiter);
223 visit(link.head); 223 visit(link.head);
224 } 224 }
225 } 225 }
226 226
227 visitNodeList(NodeList node) { 227 visitNodeList(NodeList node) {
228 addToken(node.beginToken); 228 addToken(node.beginToken);
229 if (node.nodes != null) { 229 if (node.nodes != null) {
230 unparseNodeListFrom(node, node.nodes); 230 unparseNodeListFrom(node, node.nodes);
231 } 231 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 591 }
592 592
593 visitStatement(Statement node) { 593 visitStatement(Statement node) {
594 throw 'internal error'; // Should not be called. 594 throw 'internal error'; // Should not be called.
595 } 595 }
596 596
597 visitStringNode(StringNode node) { 597 visitStringNode(StringNode node) {
598 throw 'internal error'; // Should not be called. 598 throw 'internal error'; // Should not be called.
599 } 599 }
600 } 600 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/tree/prettyprint.dart ('k') | lib/compiler/implementation/tree_validator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698