* Processes the provided classy. * @param {ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration} classy a class node * @returns {void}
(classy)
| 2075 | * @returns {void} |
| 2076 | */ |
| 2077 | walkClass(classy) { |
| 2078 | if ( |
| 2079 | classy.superClass && |
| 2080 | !this.hooks.classExtendsExpression.call(classy.superClass, classy) |
| 2081 | ) { |
| 2082 | this.walkExpression(classy.superClass); |
| 2083 | } |
| 2084 | if (classy.body && classy.body.type === "ClassBody") { |
| 2085 | /** @type {Identifier[]} */ |
| 2086 | const scopeParams = []; |
| 2087 | // Add class name in scope for recursive calls |
| 2088 | if (classy.id) { |
| 2089 | scopeParams.push(classy.id); |
| 2090 | } |
| 2091 | this.inClassScope(true, scopeParams, () => { |
| 2092 | for (const classElement of classy.body.body) { |
| 2093 | if (!this.hooks.classBodyElement.call(classElement, classy)) { |
| 2094 | if (classElement.type === "StaticBlock") { |
| 2095 | const wasTopLevel = this.scope.topLevelScope; |
| 2096 | this.scope.topLevelScope = false; |
| 2097 | this.walkBlockStatement(classElement); |
| 2098 | this.scope.topLevelScope = wasTopLevel; |
| 2099 | } else { |
| 2100 | if (classElement.computed && classElement.key) { |
| 2101 | this.walkExpression(classElement.key); |
| 2102 | } |
| 2103 | |
| 2104 | if ( |
| 2105 | classElement.value && |
| 2106 | !this.hooks.classBodyValue.call( |
| 2107 | classElement.value, |
| 2108 | classElement, |
| 2109 | classy |
| 2110 | ) |
| 2111 | ) { |
| 2112 | const wasTopLevel = this.scope.topLevelScope; |
| 2113 | this.scope.topLevelScope = false; |
| 2114 | this.walkExpression(classElement.value); |
| 2115 | this.scope.topLevelScope = wasTopLevel; |
| 2116 | } |
| 2117 | } |
| 2118 | } |
| 2119 | } |
| 2120 | }); |
| 2121 | } |
| 2122 | } |
| 2123 | |
| 2124 | /** |
| 2125 | * Module pre walking iterates the scope for import entries |
no test coverage detected