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

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

Issue 235883016: pkg/docgen: support better const rendering of String, List, and empty Map (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
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 library docgen.models; 5 library docgen.models;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:markdown/markdown.dart' as markdown; 9 import 'package:markdown/markdown.dart' as markdown;
10 10
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (domAnnotation == null) return ''; 467 if (domAnnotation == null) return '';
468 var domName = domAnnotation.parameters.single; 468 var domName = domAnnotation.parameters.single;
469 469
470 return mdnComment(rootDirectory, logger, domName); 470 return mdnComment(rootDirectory, logger, domName);
471 } 471 }
472 472
473 String get packagePrefix => owner.packagePrefix; 473 String get packagePrefix => owner.packagePrefix;
474 } 474 }
475 475
476 /// A class containing contents of a Dart class. 476 /// A class containing contents of a Dart class.
477 class Class 477 class Class extends OwnedIndexable<dart2js_mirrors.Dart2JsInterfaceTypeMirror>
478 extends OwnedIndexable<dart2js_mirrors.Dart2JsInterfaceTypeMirror>
479 implements Comparable<Class> { 478 implements Comparable<Class> {
480 479
481 /// List of the names of interfaces that this class implements. 480 /// List of the names of interfaces that this class implements.
482 List<Class> interfaces = []; 481 List<Class> interfaces = [];
483 482
484 /// Names of classes that extends or implements this class. 483 /// Names of classes that extends or implements this class.
485 Set<Class> subclasses = new Set<Class>(); 484 Set<Class> subclasses = new Set<Class>();
486 485
487 /// Top-level variables in the class. 486 /// Top-level variables in the class.
488 Map<String, Variable> variables; 487 Map<String, Variable> variables;
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 final String defaultValue; 974 final String defaultValue;
976 /// List of the meta annotations on the parameter. 975 /// List of the meta annotations on the parameter.
977 final List<Annotation> annotations; 976 final List<Annotation> annotations;
978 977
979 Parameter(ParameterMirror mirror, Library owningLibrary) 978 Parameter(ParameterMirror mirror, Library owningLibrary)
980 : this.mirror = mirror, 979 : this.mirror = mirror,
981 name = dart2js_util.nameOf(mirror), 980 name = dart2js_util.nameOf(mirror),
982 isOptional = mirror.isOptional, 981 isOptional = mirror.isOptional,
983 isNamed = mirror.isNamed, 982 isNamed = mirror.isNamed,
984 hasDefaultValue = mirror.hasDefaultValue, 983 hasDefaultValue = mirror.hasDefaultValue,
985 defaultValue = '${mirror.defaultValue}', 984 defaultValue = getDefaultValue(mirror),
986 type = new Type(mirror.type, owningLibrary), 985 type = new Type(mirror.type, owningLibrary),
987 annotations = createAnnotations(mirror, owningLibrary); 986 annotations = createAnnotations(mirror, owningLibrary);
988 987
989 /// Generates a map describing the [Parameter] object. 988 /// Generates a map describing the [Parameter] object.
990 Map toMap() => { 989 Map toMap() => {
991 'name': name, 990 'name': name,
992 'optional': isOptional, 991 'optional': isOptional,
993 'named': isNamed, 992 'named': isNamed,
994 'default': hasDefaultValue, 993 'default': hasDefaultValue,
995 'type': new List.filled(1, type.toMap()), 994 'type': new List.filled(1, type.toMap()),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 .map((e) => originalMirror.getField(e.simpleName).reflectee) 1063 .map((e) => originalMirror.getField(e.simpleName).reflectee)
1065 .where((e) => e != null) 1064 .where((e) => e != null)
1066 .toList(); 1065 .toList();
1067 } 1066 }
1068 1067
1069 Map toMap() => { 1068 Map toMap() => {
1070 'name': getDocgenObject(mirror, owningLibrary).docName, 1069 'name': getDocgenObject(mirror, owningLibrary).docName,
1071 'parameters': parameters 1070 'parameters': parameters
1072 }; 1071 };
1073 } 1072 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698