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

Side by Side Diff: pkg/docgen/lib/docgen.dart

Issue 18242010: used lookupInScope(name) to find the qualified names in comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 * **docgen** is a tool for creating machine readable representations of Dart 6 * **docgen** is a tool for creating machine readable representations of Dart
7 * code metadata, including: classes, members, comments and annotations. 7 * code metadata, including: classes, members, comments and annotations.
8 * 8 *
9 * docgen is run on a `.dart` file or a directory containing `.dart` files. 9 * docgen is run on a `.dart` file or a directory containing `.dart` files.
10 * 10 *
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 commentText = commentText == null ? '' : 268 commentText = commentText == null ? '' :
269 markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver) 269 markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver)
270 .replaceAll('\n', ' '); 270 .replaceAll('\n', ' ');
271 return commentText; 271 return commentText;
272 } 272 }
273 273
274 /** 274 /**
275 * Converts all [_] references in comments to <code>_</code>. 275 * Converts all [_] references in comments to <code>_</code>.
276 */ 276 */
277 // TODO(tmandel): Create proper links for [_] style markdown based 277 // TODO(tmandel): Create proper links for [_] style markdown based
278 // on scope once layout of viewer is finished. 278 // on scope once layout of viewer is finished.
Tate Mandel 2013/07/09 16:43:26 Remove this TODO.
janicejl 2013/07/09 19:49:21 Done.
279 markdown.Node fixReference(String name, LibraryMirror currentLibrary, 279 markdown.Node fixReference(String name, LibraryMirror currentLibrary,
280 ClassMirror currentClass, MemberMirror currentMember) { 280 ClassMirror currentClass, MemberMirror currentMember) {
281 return new markdown.Element.text('code', name); 281
282 var reference;
283 var libraryScope = currentLibrary.lookupInScope(name);
Tate Mandel 2013/07/09 16:43:26 I feel as though it should go the other way around
janicejl 2013/07/09 19:49:21 Done.
284 if (libraryScope != null) reference = libraryScope.qualifiedName;
285 else {
286 var classScope = currentClass == null ?
287 null : currentClass.lookupInScope(name);
288 if (classScope != null) reference = classScope.qualifiedName;
289 else {
290 var memberScope = currentMember == null ?
291 null : currentMember.lookupInScope(name);
292 reference = memberScope != null ? memberScope.qualifiedname : name;
293 }
294 }
295 return new markdown.Element.text('code', reference);
Tate Mandel 2013/07/09 16:43:26 We probably don't want this as a <code> tag anymor
janicejl 2013/07/09 19:49:21 Done.
282 } 296 }
283 297
284 /** 298 /**
285 * Returns a map of [Variable] objects constructed from inputted mirrors. 299 * Returns a map of [Variable] objects constructed from inputted mirrors.
286 */ 300 */
287 Map<String, Variable> _getVariables(Map<String, VariableMirror> mirrorMap, 301 Map<String, Variable> _getVariables(Map<String, VariableMirror> mirrorMap,
288 bool includePrivate) { 302 bool includePrivate) {
289 var data = {}; 303 var data = {};
290 // TODO(janicejl): When map to map feature is created, replace the below with 304 // TODO(janicejl): When map to map feature is created, replace the below with
291 // a filter. Issue(#9590). 305 // a filter. Issue(#9590).
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 parameterMap['qualifiedname'] = qualifiedName; 584 parameterMap['qualifiedname'] = qualifiedName;
571 parameterMap['optional'] = isOptional.toString(); 585 parameterMap['optional'] = isOptional.toString();
572 parameterMap['named'] = isNamed.toString(); 586 parameterMap['named'] = isNamed.toString();
573 parameterMap['default'] = hasDefaultValue.toString(); 587 parameterMap['default'] = hasDefaultValue.toString();
574 parameterMap['type'] = type; 588 parameterMap['type'] = type;
575 parameterMap['value'] = defaultValue; 589 parameterMap['value'] = defaultValue;
576 parameterMap['annotations'] = new List.from(annotations); 590 parameterMap['annotations'] = new List.from(annotations);
577 return parameterMap; 591 return parameterMap;
578 } 592 }
579 } 593 }
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