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

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

Issue 730163002: Fix leftover checks for dart- names in docgen (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | pkg/docgen/lib/src/models/doc_gen_type.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 library docgen.models.clazz; 5 library docgen.models.clazz;
6 6
7 import '../exports/dart2js_mirrors.dart' as dart2js_mirrors; 7 import '../exports/dart2js_mirrors.dart' as dart2js_mirrors;
8 import '../exports/mirrors_util.dart' as dart2js_util; 8 import '../exports/mirrors_util.dart' as dart2js_util;
9 import '../exports/source_mirrors.dart'; 9 import '../exports/source_mirrors.dart';
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 }); 162 });
163 return result; 163 return result;
164 } 164 }
165 165
166 /// Add the subclass to the class. 166 /// Add the subclass to the class.
167 /// 167 ///
168 /// If [this] is private (or an intermediary mixin class), it will add the 168 /// If [this] is private (or an intermediary mixin class), it will add the
169 /// subclass to the list of subclasses in the superclasses. 169 /// subclass to the list of subclasses in the superclasses.
170 void addSubclass(Class subclass) { 170 void addSubclass(Class subclass) {
171 if (docName == 'dart-core.Object') return; 171 if (docName == 'dart:core.Object') return;
172 172
173 if (!includePrivateMembers && isPrivate || mirror.isNameSynthetic) { 173 if (!includePrivateMembers && isPrivate || mirror.isNameSynthetic) {
174 if (_superclass != null) _superclass.addSubclass(subclass); 174 if (_superclass != null) _superclass.addSubclass(subclass);
175 interfaces.forEach((interface) { 175 interfaces.forEach((interface) {
176 interface.addSubclass(subclass); 176 interface.addSubclass(subclass);
177 }); 177 });
178 } else { 178 } else {
179 subclasses.add(subclass); 179 subclasses.add(subclass);
180 } 180 }
181 } 181 }
182 182
183 /// Check if this [Class] is an error or exception. 183 /// Check if this [Class] is an error or exception.
184 bool isError() { 184 bool isError() {
185 if (qualifiedName == 'dart-core.Error' || 185 if (qualifiedName == 'dart:core.Error' ||
186 qualifiedName == 'dart-core.Exception') 186 qualifiedName == 'dart:core.Exception')
187 return true; 187 return true;
188 for (var interface in interfaces) { 188 for (var interface in interfaces) {
189 if (interface.isError()) return true; 189 if (interface.isError()) return true;
190 } 190 }
191 if (_superclass == null) return false; 191 if (_superclass == null) return false;
192 return _superclass.isError(); 192 return _superclass.isError();
193 } 193 }
194 194
195 /// Makes sure that all methods with inherited equivalents have comments. 195 /// Makes sure that all methods with inherited equivalents have comments.
196 void ensureComments() { 196 void ensureComments() {
(...skipping 11 matching lines...) Expand all
208 // we need to populate the comments for all methods. so that the subclasses 208 // we need to populate the comments for all methods. so that the subclasses
209 // can get for their inherited versions the comments. 209 // can get for their inherited versions the comments.
210 methods.forEach((qualifiedName, method) { 210 methods.forEach((qualifiedName, method) {
211 if (!method.mirror.isConstructor) method.ensureCommentFor(method); 211 if (!method.mirror.isConstructor) method.ensureCommentFor(method);
212 }); 212 });
213 } 213 }
214 214
215 /// If a class extends a private superclass, find the closest public 215 /// If a class extends a private superclass, find the closest public
216 /// superclass of the private superclass. 216 /// superclass of the private superclass.
217 String validSuperclass() { 217 String validSuperclass() {
218 if (_superclass == null) return 'dart-core.Object'; 218 if (_superclass == null) return 'dart:core.Object';
219 if (_superclass.isVisible) return _superclass.qualifiedName; 219 if (_superclass.isVisible) return _superclass.qualifiedName;
220 return _superclass.validSuperclass(); 220 return _superclass.validSuperclass();
221 } 221 }
222 222
223 /// Generates a map describing the [Class] object. 223 /// Generates a map describing the [Class] object.
224 Map toMap() => { 224 Map toMap() => {
225 'name': name, 225 'name': name,
226 'qualifiedName': qualifiedName, 226 'qualifiedName': qualifiedName,
227 'comment': comment, 227 'comment': comment,
228 'isAbstract' : isAbstract, 228 'isAbstract' : isAbstract,
229 'superclass': validSuperclass(), 229 'superclass': validSuperclass(),
230 'implements': interfaces.where((i) => i.isVisible) 230 'implements': interfaces.where((i) => i.isVisible)
231 .map((e) => e.qualifiedName).toList(), 231 .map((e) => e.qualifiedName).toList(),
232 'subclass': (subclasses.toList()..sort()) 232 'subclass': (subclasses.toList()..sort())
233 .map((x) => x.qualifiedName).toList(), 233 .map((x) => x.qualifiedName).toList(),
234 'variables': recurseMap(variables), 234 'variables': recurseMap(variables),
235 'inheritedVariables': recurseMap(inheritedVariables), 235 'inheritedVariables': recurseMap(inheritedVariables),
236 'methods': expandMethodMap(methods), 236 'methods': expandMethodMap(methods),
237 'inheritedMethods': expandMethodMap(inheritedMethods), 237 'inheritedMethods': expandMethodMap(inheritedMethods),
238 'annotations': annotations.map((a) => a.toMap()).toList(), 238 'annotations': annotations.map((a) => a.toMap()).toList(),
239 'generics': recurseMap(generics) 239 'generics': recurseMap(generics)
240 }; 240 };
241 241
242 int compareTo(Class other) => name.compareTo(other.name); 242 int compareTo(Class other) => name.compareTo(other.name);
243 243
244 bool isValidMirror(DeclarationMirror mirror) => mirror is ClassMirror; 244 bool isValidMirror(DeclarationMirror mirror) => mirror is ClassMirror;
245 } 245 }
OLDNEW
« no previous file with comments | « no previous file | pkg/docgen/lib/src/models/doc_gen_type.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698