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

Side by Side Diff: pkg/analyzer/lib/src/codegen/tools.dart

Issue 1842563003: Format everything in analyzer (Closed) Base URL: https://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 | « no previous file | pkg/analyzer/lib/src/context/context.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /**
6 * Tools for generating code in analyzer and analysis server. 6 * Tools for generating code in analyzer and analysis server.
7 */ 7 */
8 library analyzer.src.codegen.tools; 8 library analyzer.src.codegen.tools;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 /** 94 /**
95 * Generate a doc comment based on the HTML in [docs]. 95 * Generate a doc comment based on the HTML in [docs].
96 * 96 *
97 * When generating java code, the output is compatible with Javadoc, which 97 * When generating java code, the output is compatible with Javadoc, which
98 * understands certain HTML constructs. 98 * understands certain HTML constructs.
99 */ 99 */
100 void docComment(List<dom.Node> docs, {bool removeTrailingNewLine: false}) { 100 void docComment(List<dom.Node> docs, {bool removeTrailingNewLine: false}) {
101 if (containsOnlyWhitespace(docs)) return; 101 if (containsOnlyWhitespace(docs)) return;
102 if (codeGeneratorSettings.docCommentStartMarker != null) writeln(codeGenerat orSettings.docCommentStartMarker); 102 if (codeGeneratorSettings.docCommentStartMarker != null)
103 writeln(codeGeneratorSettings.docCommentStartMarker);
103 int width = codeGeneratorSettings.commentLineLength; 104 int width = codeGeneratorSettings.commentLineLength;
104 bool javadocStyle = codeGeneratorSettings.languageName == 'java'; 105 bool javadocStyle = codeGeneratorSettings.languageName == 'java';
105 indentBy(codeGeneratorSettings.docCommentLineLeader, () { 106 indentBy(codeGeneratorSettings.docCommentLineLeader, () {
106 write(nodesToText(docs, width - _state.indent.length, javadocStyle, 107 write(nodesToText(docs, width - _state.indent.length, javadocStyle,
107 removeTrailingNewLine: removeTrailingNewLine)); 108 removeTrailingNewLine: removeTrailingNewLine));
108 }); 109 });
109 if (codeGeneratorSettings.docCommentEndMarker != null) writeln(codeGenerator Settings.docCommentEndMarker); 110 if (codeGeneratorSettings.docCommentEndMarker != null)
111 writeln(codeGeneratorSettings.docCommentEndMarker);
110 } 112 }
111 113
112 /** 114 /**
113 * Execute [callback], indenting any code it outputs. 115 * Execute [callback], indenting any code it outputs.
114 */ 116 */
115 void indent(void callback()) { 117 void indent(void callback()) {
116 indentSpecial( 118 indentSpecial(
117 codeGeneratorSettings.indent, codeGeneratorSettings.indent, callback); 119 codeGeneratorSettings.indent, codeGeneratorSettings.indent, callback);
118 } 120 }
119 121
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if (lines.last.isEmpty) { 599 if (lines.last.isEmpty) {
598 lines.removeLast(); 600 lines.removeLast();
599 buffer.add(new dom.Text(lines.join('\n$indent') + '\n')); 601 buffer.add(new dom.Text(lines.join('\n$indent') + '\n'));
600 indentNeeded = true; 602 indentNeeded = true;
601 } else { 603 } else {
602 buffer.add(new dom.Text(lines.join('\n$indent'))); 604 buffer.add(new dom.Text(lines.join('\n$indent')));
603 indentNeeded = false; 605 indentNeeded = false;
604 } 606 }
605 } 607 }
606 } 608 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698