|
14 | 14 | (:import [java.util.logging Level] |
15 | 15 | [com.google.javascript.jscomp |
16 | 16 | CompilerOptions SourceFile JsAst CommandLineRunner] |
| 17 | + [com.google.javascript.jscomp.parsing Config$JsDocParsing] |
17 | 18 | [com.google.javascript.rhino |
18 | 19 | Node Token JSTypeExpression])) |
19 | 20 |
|
|
38 | 39 | (when node |
39 | 40 | (let [info (.getJSDocInfo node)] |
40 | 41 | (when info |
41 | | - (if-let [^JSTypeExpression ty (.getType info)] |
42 | | - {:tag (get-type* ty)} |
43 | | - (if (or (.isConstructor info) (.isInterface info)) |
44 | | - (let [qname (symbol (.. node getFirstChild getQualifiedName))] |
45 | | - (cond-> {:tag 'Function} |
46 | | - (.isConstructor info) (merge {:ctor qname}) |
47 | | - (.isInterface info) (merge {:iface qname}))) |
48 | | - (if (.hasReturnType info) |
49 | | - {:tag 'Function |
50 | | - :ret-tag (get-type* (.getReturnType info))}))))))) |
| 42 | + (merge |
| 43 | + (if-let [^JSTypeExpression ty (.getType info)] |
| 44 | + {:tag (get-type* ty)} |
| 45 | + (if (or (.isConstructor info) (.isInterface info)) |
| 46 | + (let [qname (symbol (.. node getFirstChild getQualifiedName))] |
| 47 | + (cond-> {:tag 'Function} |
| 48 | + (.isConstructor info) (merge {:ctor qname}) |
| 49 | + (.isInterface info) (merge {:iface qname}))) |
| 50 | + (if (.hasReturnType info) |
| 51 | + {:tag 'Function |
| 52 | + :ret-tag (get-type* (.getReturnType info))}))) |
| 53 | + (when-let [doc (.getOriginalCommentString info)] |
| 54 | + {:doc doc})))))) |
51 | 55 |
|
52 | 56 | (defmulti parse-extern-node |
53 | 57 | (fn [^Node node] |
|
108 | 112 | (defmethod parse-extern-node :default [node]) |
109 | 113 |
|
110 | 114 | (defn parse-externs [^SourceFile source-file] |
111 | | - (let [^CompilerOptions compiler-options (CompilerOptions.) |
| 115 | + (let [^CompilerOptions compiler-options |
| 116 | + (doto (CompilerOptions.) |
| 117 | + (.setParseJsDocDocumentation |
| 118 | + Config$JsDocParsing/INCLUDE_DESCRIPTIONS_WITH_WHITESPACE)) |
112 | 119 | closure-compiler |
113 | 120 | (doto |
114 | 121 | (let [compiler (com.google.javascript.jscomp.Compiler.)] |
|
0 commit comments