(module: SourceModule)
| 7448 | |
| 7449 | // e.g. `new this(A)` or `new t.constructor(A)` |
| 7450 | const constructsReflectively = (module: SourceModule): boolean => { |
| 7451 | let result = constructsByModule.get(module) |
| 7452 | if (result === undefined) { |
| 7453 | result = false |
| 7454 | walk(module.program, node => { |
| 7455 | if ( |
| 7456 | (node.type === "NewExpression" && |
| 7457 | unwrapExpression(node.callee).type === "ThisExpression") || |
| 7458 | (node.type === "MetaProperty" && node.meta.name === "new") || |
| 7459 | (node.type === "MemberExpression" && |
| 7460 | memberNameOf(node) === "constructor") |
| 7461 | ) |
| 7462 | result = true |
| 7463 | return !result |
| 7464 | }) |
| 7465 | constructsByModule.set(module, result) |
| 7466 | } |
| 7467 | return result |
| 7468 | } |
| 7469 | |
| 7470 | const importsValuesByModule = new WeakMap<SourceModule, boolean>() |
| 7471 |
no test coverage detected