OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.backend.doc; | 5 package com.google.dart.compiler.backend.doc; |
6 | 6 |
7 import com.google.common.io.CharStreams; | 7 import com.google.common.io.CharStreams; |
8 import com.google.dart.compiler.Source; | 8 import com.google.dart.compiler.Source; |
9 import com.google.dart.compiler.ast.DartClass; | 9 import com.google.dart.compiler.ast.DartClass; |
10 import com.google.dart.compiler.ast.DartComment; | 10 import com.google.dart.compiler.ast.DartComment; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 if (unitSource[index] == '/') { | 208 if (unitSource[index] == '/') { |
209 assert((index + 1 - comment.getSourceStart()) == comment.getSourceLeng
th()); | 209 assert((index + 1 - comment.getSourceStart()) == comment.getSourceLeng
th()); |
210 return buffer.toString(); | 210 return buffer.toString(); |
211 } | 211 } |
212 } | 212 } |
213 } | 213 } |
214 return ""; | 214 return ""; |
215 } | 215 } |
216 | 216 |
217 private void printClassTypeParameters(ClassElement classElement) { | 217 private void printClassTypeParameters(ClassElement classElement) { |
218 List<? extends Type> typeParameters = classElement.getTypeParameters(); | 218 List<Type> typeParameters = classElement.getTypeParameters(); |
219 if (typeParameters.size() > 0) { | 219 if (typeParameters.size() > 0) { |
220 stream.print("<"); | 220 stream.print("<"); |
221 boolean first = true; | 221 boolean first = true; |
222 for (Type type : typeParameters) { | 222 for (Type type : typeParameters) { |
223 if (!first) { | 223 if (!first) { |
224 stream.print(","); | 224 stream.print(","); |
225 } else { | 225 } else { |
226 first = false; | 226 first = false; |
227 } | 227 } |
228 escapeAndPrint(stream, type.getElement().getName()); | 228 escapeAndPrint(stream, type.getElement().getName()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 printClassReference((ClassElement) localElement); | 323 printClassReference((ClassElement) localElement); |
324 stream.print("</code>"); | 324 stream.print("</code>"); |
325 return true; | 325 return true; |
326 default: | 326 default: |
327 return false; | 327 return false; |
328 } | 328 } |
329 } | 329 } |
330 // For classes search type parameters, superclass and interfaces. | 330 // For classes search type parameters, superclass and interfaces. |
331 if (enclosing.getKind() == ElementKind.CLASS) { | 331 if (enclosing.getKind() == ElementKind.CLASS) { |
332 ClassElement classElement = (ClassElement) enclosing; | 332 ClassElement classElement = (ClassElement) enclosing; |
333 List<? extends Type> typeParameters = classElement.getTypeParameters(); | 333 List<Type> typeParameters = classElement.getTypeParameters(); |
334 for (Type type : typeParameters) { | 334 for (Type type : typeParameters) { |
335 if (type.getElement().getName().equals(name)) { | 335 if (type.getElement().getName().equals(name)) { |
336 String className = classElement.getName(); | 336 String className = classElement.getName(); |
337 String elementReference = className + "::" + className; | 337 String elementReference = className + "::" + className; |
338 LinkInformation linkInfo = new LinkInformation(classElement.getLibrary
().getName(), | 338 LinkInformation linkInfo = new LinkInformation(classElement.getLibrary
().getName(), |
339 className, | 339 className, |
340 elementReference); | 340 elementReference); |
341 links.add(linkInfo); | 341 links.add(linkInfo); |
342 stream.print("<code>"); | 342 stream.print("<code>"); |
343 stream.print(linkInfo.anchorReferenceStartTag()); | 343 stream.print(linkInfo.anchorReferenceStartTag()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 return null; | 422 return null; |
423 } | 423 } |
424 | 424 |
425 @Override | 425 @Override |
426 public Void visitClass(DartClass node) { | 426 public Void visitClass(DartClass node) { |
427 documentClass(node.getSymbol()); | 427 documentClass(node.getSymbol()); |
428 return null; | 428 return null; |
429 } | 429 } |
430 | 430 |
431 private void printFunctionTypeParameterList(FunctionType type, Element element
) { | 431 private void printFunctionTypeParameterList(FunctionType type, Element element
) { |
432 List<? extends Type> paramTypes = type.getParameterTypes(); | 432 List<Type> paramTypes = type.getParameterTypes(); |
433 stream.print("("); | 433 stream.print("("); |
434 boolean first = true; | 434 boolean first = true; |
435 for (Type paramType : paramTypes) { | 435 for (Type paramType : paramTypes) { |
436 if (first) { | 436 if (first) { |
437 first = false; | 437 first = false; |
438 } else { | 438 } else { |
439 stream.print(", "); | 439 stream.print(", "); |
440 } | 440 } |
441 if (!printElementReference(element, paramType.getElement().getName())) { | 441 if (!printElementReference(element, paramType.getElement().getName())) { |
442 escapeAndPrint(stream, paramType.getElement().getName()); | 442 escapeAndPrint(stream, paramType.getElement().getName()); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 printElementComment(constr); | 800 printElementComment(constr); |
801 stream.println("</dd>"); | 801 stream.println("</dd>"); |
802 } | 802 } |
803 | 803 |
804 private void documentToplevelMethod(MethodElement method) { | 804 private void documentToplevelMethod(MethodElement method) { |
805 } | 805 } |
806 | 806 |
807 private void documentToplevelField(FieldElement field) { | 807 private void documentToplevelField(FieldElement field) { |
808 } | 808 } |
809 } | 809 } |
OLD | NEW |