| 1 | import type { NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#, Visitorscip-typescript npm @babel/traverse 7.20.13 src/`types.ts`/Visitor# } from "@babel/traverse"scip-typescript npm @babel/traverse 7.20.13 src/`index.ts`/; |
| 2 | import type * as tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/ from "@babel/types"scip-typescript npm @babel/types 7.20.7 src/`index.ts`/; |
| 3 | |
| 4 | // TODO (Babel 8): Don't export this function. |
| 5 | export function skipAllButComputedKeyscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/skipAllButComputedKey().( |
| 6 | pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/skipAllButComputedKey().(path): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Methodscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Method# | tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.ClassPropertyscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/ClassProperty#>, |
| 7 | ) { |
| 8 | pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/skipAllButComputedKey().(path).skipscip-typescript npm @babel/traverse 7.20.13 src/path/`context.ts`/skip().(); |
| 9 | if (pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/skipAllButComputedKey().(path).nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node..computedscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/ClassMethod#computed.) { |
| 10 | // requeue the computed key |
| 11 | pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/skipAllButComputedKey().(path).contextscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#context..maybeQueuescip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#maybeQueue().(pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/skipAllButComputedKey().(path).get("key")); |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | export function requeueComputedKeyAndDecoratorsscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/requeueComputedKeyAndDecorators().( |
| 16 | pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/requeueComputedKeyAndDecorators().(path): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Methodscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Method# | tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Propertyscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Property#>, |
| 17 | ) { |
| 18 | const { contextscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#context., nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node. } = pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/requeueComputedKeyAndDecorators().(path); |
| 19 | // @ts-expect-error ClassPrivateProperty does not have computed |
| 20 | if (node.computed) { |
| 21 | // requeue the computed key |
| 22 | context.maybeQueuescip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#maybeQueue().(pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/requeueComputedKeyAndDecorators().(path).get("key")); |
| 23 | } |
| 24 | if (node.decoratorsscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/ClassAccessorProperty#decorators.) { |
| 25 | for (const decorator of pathscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/requeueComputedKeyAndDecorators().(path).get("decorators")) { |
| 26 | // requeue the decorators |
| 27 | context.maybeQueuescip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#maybeQueue().(decorator); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | // environmentVisitor should be used when traversing the whole class and not for specific class elements/methods. |
| 33 | // For perf reasons, the environmentVisitor might be traversed with `{ noScope: true }`, which means `path.scope` is undefined. |
| 34 | // Avoid using `path.scope` here |
| 35 | const visitorscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/visitor.: Visitorscip-typescript npm @babel/traverse 7.20.13 src/`types.ts`/Visitor# = { |
| 36 | FunctionParentscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Aliases#FunctionParent.(path) { |
| 37 | if (path.isArrowFunctionExpressionscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isArrowFunctionExpression().()) { |
| 38 | // arrows are not skipped because they inherit the context. |
| 39 | return; |
| 40 | } else { |
| 41 | path.skipscip-typescript npm @babel/traverse 7.20.13 src/path/`context.ts`/skip().(); |
| 42 | if (path.isMethodscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isMethod().()) { |
| 43 | requeueComputedKeyAndDecoratorsscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/requeueComputedKeyAndDecorators().(path); |
| 44 | } |
| 45 | } |
| 46 | }, |
| 47 | Propertyscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Aliases#Property.(path) { |
| 48 | if (path.isObjectPropertyscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isObjectProperty().()) { |
| 49 | return; |
| 50 | } |
| 51 | path.skipscip-typescript npm @babel/traverse 7.20.13 src/path/`context.ts`/skip().(); |
| 52 | requeueComputedKeyAndDecoratorsscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/requeueComputedKeyAndDecorators().(path); |
| 53 | }, |
| 54 | }; |
| 55 | |
| 56 | export default visitorscip-typescript npm @babel/helper-environment-visitor 7.18.9 src/`index.ts`/visitor.; |