( call: CallExpression, module: SourceModule, kindOfKey: KindOfKey )
| 4495 | |
| 4496 | // e.g. `scope({ ... })`, `generic("t")({ ... })` or `type("<t>", { ... })` |
| 4497 | private definesGeneric( |
| 4498 | call: CallExpression, |
| 4499 | module: SourceModule, |
| 4500 | kindOfKey: KindOfKey |
| 4501 | ): boolean { |
| 4502 | const callee = unwrapChain(call.callee) |
| 4503 | const [params] = call.arguments |
| 4504 | if ( |
| 4505 | call.arguments.length === 2 && |
| 4506 | params.type === "Literal" && |
| 4507 | /^<.*>$/.test(String(params.value)) |
| 4508 | ) |
| 4509 | return this.isParser(callee, "type", module, kindOfKey) |
| 4510 | if (callee.type !== "CallExpression") return false |
| 4511 | const parser = unwrapChain(callee.callee) |
| 4512 | return ( |
| 4513 | this.arkExportNameOf(parser, module) === "generic" || |
| 4514 | this.isParser(parser, "generic", module, kindOfKey) |
| 4515 | ) |
| 4516 | } |
| 4517 | |
| 4518 | private isParser( |
| 4519 | node: Node, |
no test coverage detected