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

Side by Side Diff: pkg/analysis_server/tool/spec/to_html.dart

Issue 469673002: Add union types to the analysis server API spec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | « pkg/analysis_server/tool/spec/spec_input.html ('k') | 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) 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 * Code for displaying the API as HTML. This is used both for generating a 6 * Code for displaying the API as HTML. This is used both for generating a
7 * full description of the API as a web page, and for generating doc comments 7 * full description of the API as a web page, and for generating doc comments
8 * in generated code. 8 * in generated code.
9 */ 9 */
10 library to.html; 10 library to.html;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void visitTypeReference(TypeReference typeReference) { 188 void visitTypeReference(TypeReference typeReference) {
189 String displayName = typeReference.typeName; 189 String displayName = typeReference.typeName;
190 if (api.types.containsKey(typeReference.typeName)) { 190 if (api.types.containsKey(typeReference.typeName)) {
191 link('type_${typeReference.typeName}', () { 191 link('type_${typeReference.typeName}', () {
192 write(displayName); 192 write(displayName);
193 }); 193 });
194 } else { 194 } else {
195 write(displayName); 195 write(displayName);
196 } 196 }
197 } 197 }
198
199 @override
200 void visitTypeUnion(TypeUnion typeUnion) {
201 bool verticalBarNeeded = false;
202 for (TypeDecl choice in typeUnion.choices) {
203 if (verticalBarNeeded) {
204 write(' | ');
205 }
206 visitTypeDecl(choice);
207 verticalBarNeeded = true;
208 }
209 }
198 } 210 }
199 211
200 /** 212 /**
201 * Visitor that records the mapping from HTML elements to various kinds of API 213 * Visitor that records the mapping from HTML elements to various kinds of API
202 * nodes. 214 * nodes.
203 */ 215 */
204 class ApiMappings extends HierarchicalApiVisitor { 216 class ApiMappings extends HierarchicalApiVisitor {
205 ApiMappings(Api api) : super(api); 217 ApiMappings(Api api) : super(api);
206 218
207 Map<dom.Element, Domain> domains = <dom.Element, Domain>{}; 219 Map<dom.Element, Domain> domains = <dom.Element, Domain>{};
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 */ 546 */
535 main() { 547 main() {
536 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi()); 548 ToHtmlVisitor visitor = new ToHtmlVisitor(readApi());
537 dom.Document document = new dom.Document(); 549 dom.Document document = new dom.Document();
538 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) { 550 for (dom.Node node in visitor.collectHtml(visitor.visitApi)) {
539 document.append(node); 551 document.append(node);
540 } 552 }
541 File outputFile = new File('../../doc/api.html'); 553 File outputFile = new File('../../doc/api.html');
542 outputFile.writeAsStringSync(document.outerHtml); 554 outputFile.writeAsStringSync(document.outerHtml);
543 } 555 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/spec_input.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698