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

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

Issue 10582038: Add null check. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class Unparser implements Visitor { 5 class Unparser implements Visitor {
6 StringBuffer sb; 6 StringBuffer sb;
7 7
8 Unparser(); 8 Unparser();
9 9
10 String unparse(Node node) { 10 String unparse(Node node) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 visitFunctionExpression(FunctionExpression node) { 84 visitFunctionExpression(FunctionExpression node) {
85 if (node.returnType !== null) { 85 if (node.returnType !== null) {
86 visit(node.returnType); 86 visit(node.returnType);
87 sb.add(' '); 87 sb.add(' ');
88 } 88 }
89 // TODO(antonm): that's a workaround as currently FunctionExpression 89 // TODO(antonm): that's a workaround as currently FunctionExpression
90 // names are modelled with Send and it emits operator[] as only 90 // names are modelled with Send and it emits operator[] as only
91 // operator, without [] which are expected to be emitted with 91 // operator, without [] which are expected to be emitted with
92 // arguments. 92 // arguments.
93 Send send = node.name.asSend(); 93 Send send = node.name !== null ? node.name.asSend() : null;
ahe 2012/06/20 19:25:45 Perhaps you should change this to use: if (node.n
Anton Muhin 2012/06/20 19:34:49 Done. What's wrong w/ indentation?
94 if (send !== null) { 94 if (send !== null) {
95 assert(send is !SendSet); 95 assert(send is !SendSet);
96 visit(send.receiver); 96 visit(send.receiver);
97 visit(send.selector); 97 visit(send.selector);
98 } else { 98 } else {
99 visit(node.name); 99 visit(node.name);
100 } 100 }
101 visit(node.parameters); 101 visit(node.parameters);
102 visit(node.body); 102 visit(node.body);
103 } 103 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 sb.add(' '); 443 sb.add(' ');
444 } 444 }
445 visit(node.name); 445 visit(node.name);
446 if (node.typeParameters !== null) { 446 if (node.typeParameters !== null) {
447 visit(node.typeParameters); 447 visit(node.typeParameters);
448 } 448 }
449 visit(node.formals); 449 visit(node.formals);
450 add(node.endToken.value); 450 add(node.endToken.value);
451 } 451 }
452 } 452 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698