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

Side by Side Diff: pkg/compiler/lib/src/js/js_debug.dart

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/js/js.dart ('k') | pkg/compiler/lib/src/js/js_source_mapping.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Helper for debug JS nodes. 5 /// Helper for debug JS nodes.
6 6
7 library js.debug; 7 library js.debug;
8 8
9 import 'package:js_ast/js_ast.dart'; 9 import 'package:js_ast/js_ast.dart';
10 10
11 import '../io/code_output.dart' show 11 import '../io/code_output.dart' show BufferedCodeOutput;
12 BufferedCodeOutput; 12 import '../util/util.dart' show Indentation, Tagging;
13 import '../util/util.dart' show
14 Indentation,
15 Tagging;
16 13
17 /// Unparse the JavaScript [node]. 14 /// Unparse the JavaScript [node].
18 String nodeToString(Node node) { 15 String nodeToString(Node node) {
19 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( 16 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions(
20 shouldCompressOutput: true, 17 shouldCompressOutput: true,
21 preferSemicolonToNewlineInMinifiedOutput: true); 18 preferSemicolonToNewlineInMinifiedOutput: true);
22 LenientPrintingContext printingContext = 19 LenientPrintingContext printingContext = new LenientPrintingContext();
23 new LenientPrintingContext();
24 new Printer(options, printingContext).visit(node); 20 new Printer(options, printingContext).visit(node);
25 return printingContext.getText(); 21 return printingContext.getText();
26 } 22 }
27 23
28 /// Visitor that creates an XML-like representation of the structure of a 24 /// Visitor that creates an XML-like representation of the structure of a
29 /// JavaScript [Node]. 25 /// JavaScript [Node].
30 class DebugPrinter extends BaseVisitor with Indentation, Tagging<Node> { 26 class DebugPrinter extends BaseVisitor with Indentation, Tagging<Node> {
31 StringBuffer sb = new StringBuffer(); 27 StringBuffer sb = new StringBuffer();
32 28
33 void visitNodeWithChildren(Node node, String type, [Map params]) { 29 void visitNodeWithChildren(Node node, String type, [Map params]) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 63 }
68 64
69 /// Simple printing context that doesn't throw on errors. 65 /// Simple printing context that doesn't throw on errors.
70 class LenientPrintingContext extends SimpleJavaScriptPrintingContext 66 class LenientPrintingContext extends SimpleJavaScriptPrintingContext
71 implements BufferedCodeOutput { 67 implements BufferedCodeOutput {
72 @override 68 @override
73 void error(String message) { 69 void error(String message) {
74 buffer.write('>>$message<<'); 70 buffer.write('>>$message<<');
75 } 71 }
76 } 72 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js/js.dart ('k') | pkg/compiler/lib/src/js/js_source_mapping.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698