OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dev_compiler.src.closure.closure_annotation; | |
6 | |
7 import 'closure_type.dart'; | 5 import 'closure_type.dart'; |
8 | 6 |
9 /// Set of closure annotations that can be [toString]ed to a single JsDoc commen
t. | 7 /// Set of closure annotations that can be [toString]ed to a single JsDoc commen
t. |
10 /// See https://developers.google.com/closure/compiler/docs/js-for-compiler | 8 /// See https://developers.google.com/closure/compiler/docs/js-for-compiler |
11 /// | 9 /// |
12 /// TODO(ochafik): Support inclusion of 'normal' comments (including @param comm
ents). | 10 /// TODO(ochafik): Support inclusion of 'normal' comments (including @param comm
ents). |
13 class ClosureAnnotation { | 11 class ClosureAnnotation { |
14 final bool isConst; | 12 final bool isConst; |
15 final bool isConstructor; | 13 final bool isConstructor; |
16 final bool isFinal; | 14 final bool isFinal; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (isNonWildcard(returnType)) lines.add('@return {$returnType}'); | 113 if (isNonWildcard(returnType)) lines.add('@return {$returnType}'); |
116 if (isNonWildcard(throwsType)) lines.add('@throws {$throwsType}'); | 114 if (isNonWildcard(throwsType)) lines.add('@throws {$throwsType}'); |
117 | 115 |
118 if (lines.length == 0) return ''; | 116 if (lines.length == 0) return ''; |
119 if (lines.length == 1) return '/** ${lines.single} */'; | 117 if (lines.length == 1) return '/** ${lines.single} */'; |
120 __cachedString = '/**\n' + lines.map((l) => ' * $l').join('\n') + '\n */'; | 118 __cachedString = '/**\n' + lines.map((l) => ' * $l').join('\n') + '\n */'; |
121 } | 119 } |
122 return __cachedString; | 120 return __cachedString; |
123 } | 121 } |
124 } | 122 } |
OLD | NEW |