(path, options, print)
| 104 | - `TSDeclareMethod` (TypeScript) |
| 105 | */ |
| 106 | function printMethod(path, options, print) { |
| 107 | const { node } = path; |
| 108 | const { kind } = node; |
| 109 | const value = node.value || node; |
| 110 | const parts = []; |
| 111 | |
| 112 | if (!kind || kind === "init" || kind === "method" || kind === "constructor") { |
| 113 | if (value.async) { |
| 114 | parts.push("async "); |
| 115 | } |
| 116 | } else { |
| 117 | assert.ok(kind === "get" || kind === "set"); |
| 118 | |
| 119 | parts.push(kind, " "); |
| 120 | } |
| 121 | |
| 122 | // A `getter`/`setter` can't be a generator, but it's recoverable |
| 123 | if (value.generator) { |
| 124 | parts.push("*"); |
| 125 | } |
| 126 | |
| 127 | parts.push( |
| 128 | printKey(path, options, print), |
| 129 | node.optional ? "?" : "", |
| 130 | node === value ? printMethodValue(path, options, print) : print("value"), |
| 131 | ); |
| 132 | |
| 133 | return parts; |
| 134 | } |
| 135 | |
| 136 | /* |
| 137 | - `ObjectMethod` |
no test coverage detected
searching dependent graphs…