(this: NodePath)
| 60 | } |
| 61 | |
| 62 | export function _forceSetScope(this: NodePath) { |
| 63 | let path = this.parentPath; |
| 64 | |
| 65 | if ( |
| 66 | // Skip method scope if is computed method key or decorator expression |
| 67 | ((this.key === "key" || this.listKey === "decorators") && |
| 68 | path.isMethod()) || |
| 69 | // Skip switch scope if for discriminant (`x` in `switch (x) {}`). |
| 70 | (this.key === "discriminant" && path.isSwitchStatement()) |
| 71 | ) { |
| 72 | path = path.parentPath; |
| 73 | } |
| 74 | |
| 75 | let target; |
| 76 | while (path && !target) { |
| 77 | target = path.scope; |
| 78 | path = path.parentPath; |
| 79 | } |
| 80 | |
| 81 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion |
| 82 | this.scope = this.getScope(target!); |
| 83 | this.scope?.init(); |
| 84 | } |
| 85 | |
| 86 | export function setScope(this: NodePath<t.Node | null>) { |
| 87 | if (this.opts?.noScope) return; |
nothing calls this directly
no test coverage detected
searching dependent graphs…