@@ -274,7 +274,6 @@ function get_function_label(nodes) {
274274}
275275
276276/**
277- *
278277 * @param {AST.SvelteNode } parent
279278 * @param {Context } context
280279 */
@@ -283,7 +282,6 @@ function is_variable_declaration(parent, context) {
283282}
284283
285284/**
286- *
287285 * @param {AST.SvelteNode } parent
288286 */
289287function is_class_property_definition ( parent ) {
@@ -293,28 +291,21 @@ function is_class_property_definition(parent) {
293291/**
294292 * @param {AST.SvelteNode } node
295293 * @param {Context } context
296- * @returns {node is AssignmentExpression & { left: { type: 'MemberExpression' } & { object: { type: 'ThisExpression' }; property: { type: 'Identifier' | 'PrivateIdentifier' | 'Literal' } } } }
297294 */
298295function is_class_property_assignment_at_constructor_root ( node , context ) {
299296 if (
300- ! (
301- node . type === 'AssignmentExpression' &&
302- node . operator === '=' &&
303- node . left . type === 'MemberExpression' &&
304- node . left . object . type === 'ThisExpression' &&
305- ( ( node . left . property . type === 'Identifier' && ! node . left . computed ) ||
306- node . left . property . type === 'PrivateIdentifier' ||
307- node . left . property . type === 'Literal' )
308- )
297+ node . type === 'AssignmentExpression' &&
298+ node . operator === '=' &&
299+ node . left . type === 'MemberExpression' &&
300+ node . left . object . type === 'ThisExpression' &&
301+ ( ( node . left . property . type === 'Identifier' && ! node . left . computed ) ||
302+ node . left . property . type === 'PrivateIdentifier' ||
303+ node . left . property . type === 'Literal' )
309304 ) {
310- return false ;
305+ // MethodDefinition (-5) -> FunctionExpression (-4) -> BlockStatement (-3) -> ExpressionStatement (-2) -> AssignmentExpression (-1)
306+ const parent = get_parent ( context . path , - 5 ) ;
307+ return parent ?. type === 'MethodDefinition' && parent . kind === 'constructor' ;
311308 }
312309
313- // AssignmentExpression (here) -> ExpressionStatement (-1) -> BlockStatement (-2) -> FunctionExpression (-3) -> MethodDefinition (-4)
314- const maybe_constructor = get_parent ( context . path , - 5 ) ;
315- return (
316- maybe_constructor &&
317- maybe_constructor . type === 'MethodDefinition' &&
318- maybe_constructor . kind === 'constructor'
319- ) ;
310+ return false ;
320311}
0 commit comments