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

Side by Side Diff: pkg/kernel/lib/text/ast_to_text.dart

Issue 2617973002: Print <<NULL>> instead of crashing. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library kernel.ast_to_text; 4 library kernel.ast_to_text;
5 5
6 import '../ast.dart'; 6 import '../ast.dart';
7 import '../import_table.dart'; 7 import '../import_table.dart';
8 import '../type_propagation/type_propagation.dart'; 8 import '../type_propagation/type_propagation.dart';
9 9
10 class Namer<T> { 10 class Namer<T> {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (state == WORD) { 386 if (state == WORD) {
387 writeSpace(); 387 writeSpace();
388 } 388 }
389 } 389 }
390 390
391 void writeIndentation() { 391 void writeIndentation() {
392 writeSpace(' ' * indentation); 392 writeSpace(' ' * indentation);
393 } 393 }
394 394
395 void writeNode(Node node) { 395 void writeNode(Node node) {
396 node.accept(this); 396 if (node == null) {
397 writeSymbol("<<NULL>>");
ahe 2017/01/06 15:32:31 Any suggestions for a better string to use here?
asgerf 2017/01/06 15:33:36 <Null> is consistent with what we write in default
ahe 2017/01/06 15:37:44 Done.
398 } else {
399 node.accept(this);
400 }
397 } 401 }
398 402
399 void writeOptionalNode(Node node) { 403 void writeOptionalNode(Node node) {
400 if (node != null) { 404 if (node != null) {
401 node.accept(this); 405 node.accept(this);
402 } 406 }
403 } 407 }
404 408
405 void writeAnnotatedType(DartType type, String annotation) { 409 void writeAnnotatedType(DartType type, String annotation) {
406 writeType(type); 410 writeType(type);
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 } 1542 }
1539 throw 'illegal ProcedureKind: $kind'; 1543 throw 'illegal ProcedureKind: $kind';
1540 } 1544 }
1541 1545
1542 class ExpressionPrinter { 1546 class ExpressionPrinter {
1543 final Printer writeer; 1547 final Printer writeer;
1544 final int minimumPrecedence; 1548 final int minimumPrecedence;
1545 1549
1546 ExpressionPrinter(this.writeer, this.minimumPrecedence); 1550 ExpressionPrinter(this.writeer, this.minimumPrecedence);
1547 } 1551 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698