(kind: Kind, text: string, line: number, column: number, depth: number)
| 168 | }; |
| 169 | |
| 170 | const token = (kind: Kind, text: string, line: number, column: number, depth: number): void => { |
| 171 | if (importTokens) { |
| 172 | importTokens.push({ kind, text }); |
| 173 | // Decided by the first token unless it is a name, then by whether `=` follows, then by what does. |
| 174 | const t = importTokens; |
| 175 | if (t.length >= 3 || t[0]!.kind !== Kind.Word || (t.length === 2 && t[1]!.text !== '=')) settleImport(); |
| 176 | } |
| 177 | if (open) { |
| 178 | if (kind === Kind.Punct && text === '}' && depth === 0) { |
| 179 | open.endLine = line; |
| 180 | open.endColumn = column; |
| 181 | open.pattern = open.specifier.includes('*'); |
| 182 | blocks.push(open); |
| 183 | open = null; |
| 184 | exportState = 0; |
| 185 | clause = []; |
| 186 | return; |
| 187 | } |
| 188 | blockToken(kind, text, depth); |
| 189 | return; |
| 190 | } |
| 191 | if (depth !== 0) { |
| 192 | declare = 0; |
| 193 | return; |
| 194 | } |
| 195 | if (kind === Kind.Word) { |
| 196 | if (text === 'import') { |
| 197 | importTokens = []; |
| 198 | declare = 0; |
| 199 | } else if (text === 'export') { |
| 200 | script = false; |
| 201 | declare = 0; |
| 202 | } else if (text === 'declare') { |
| 203 | declare = 1; |
| 204 | declareLine = line; |
| 205 | declareColumn = column; |
| 206 | } else { |
| 207 | declare = declare === 1 && text === 'module' ? 2 : 0; |
| 208 | } |
| 209 | return; |
| 210 | } |
| 211 | if (kind === Kind.String && declare === 2) { |
| 212 | declare = 3; |
| 213 | declareName = text; |
| 214 | return; |
| 215 | } |
| 216 | if (kind === Kind.Punct && text === '{' && declare === 3 && declareName) { |
| 217 | open = { |
| 218 | specifier: declareName, |
| 219 | startLine: declareLine, |
| 220 | startColumn: declareColumn, |
| 221 | endLine: 0, |
| 222 | endColumn: 0, |
| 223 | defaultName: null, |
| 224 | exportAliases: new Map(), |
| 225 | pattern: false, |
| 226 | }; |
| 227 | } |
nothing calls this directly
no test coverage detected