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

Side by Side Diff: pkg/compiler/lib/src/tree/unparser.dart

Issue 1342213003: Add optional message to assert in Dart2js - continued (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add --assert-message flag Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/tree/prettyprint.dart ('k') | pkg/compiler/lib/src/typechecker.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 part of tree; 5 part of tree;
6 6
7 String unparse(Node node, {minify: true}) { 7 String unparse(Node node, {minify: true}) {
8 Unparser unparser = new Unparser(minify: minify); 8 Unparser unparser = new Unparser(minify: minify);
9 unparser.unparse(node); 9 unparser.unparse(node);
10 return unparser.result; 10 return unparser.result;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 sb.write(s); 51 sb.write(s);
52 onEmptyLine = false; 52 onEmptyLine = false;
53 } 53 }
54 54
55 unparse(Node node) { visit(node); } 55 unparse(Node node) { visit(node); }
56 56
57 visit(Node node) { 57 visit(Node node) {
58 if (node != null) node.accept(this); 58 if (node != null) node.accept(this);
59 } 59 }
60 60
61 visitAssert(Assert node) {
62 write(node.assertToken.value);
63 write('(');
64 visit(node.condition);
65 if (node.hasMessage) {
66 write(',');
67 space();
68 visit(node.message);
69 }
70 write(');');
71 }
72
61 visitBlock(Block node) => unparseBlockStatements(node.statements); 73 visitBlock(Block node) => unparseBlockStatements(node.statements);
62 74
63 unparseBlockStatements(NodeList statements) { 75 unparseBlockStatements(NodeList statements) {
64 addToken(statements.beginToken); 76 addToken(statements.beginToken);
65 77
66 Link<Node> nodes = statements.nodes; 78 Link<Node> nodes = statements.nodes;
67 if (nodes != null && !nodes.isEmpty) { 79 if (nodes != null && !nodes.isEmpty) {
68 indentMore(); 80 indentMore();
69 newline(); 81 newline();
70 visit(nodes.head); 82 visit(nodes.head);
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 } 867 }
856 868
857 visitStatement(Statement node) { 869 visitStatement(Statement node) {
858 throw 'internal error'; // Should not be called. 870 throw 'internal error'; // Should not be called.
859 } 871 }
860 872
861 visitStringNode(StringNode node) { 873 visitStringNode(StringNode node) {
862 throw 'internal error'; // Should not be called. 874 throw 'internal error'; // Should not be called.
863 } 875 }
864 } 876 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree/prettyprint.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698