@@ -6,6 +6,7 @@ import { get_parent } from '../../../../utils/ast.js';
66import { get_rune } from '../../../scope.js' ;
77import * as e from '../../../../errors.js' ;
88import { locate_node } from '../../../../state.js' ;
9+ import { is_state_creation_rune } from '../../../../../utils.js' ;
910
1011/** @typedef {'$state' | '$state.raw' | '$derived' | '$derived.by' | 'regular' } PropertyAssignmentType */
1112/** @typedef {{ type: PropertyAssignmentType; node: AssignmentExpression | PropertyDefinition; } } PropertyAssignmentDetails */
@@ -67,7 +68,7 @@ export class ClassAnalysis {
6768 * @template {AST.SvelteNode} T
6869 * @param {AST.SvelteNode } node
6970 * @param {T[] } path
70- * @returns {node is AssignmentExpression & { left: { type: 'MemberExpression' } & { object: { type: 'ThisExpression' }; property: { type: 'Identifier' } } } }
71+ * @returns {node is AssignmentExpression & { left: { type: 'MemberExpression' } & { object: { type: 'ThisExpression' }; property: { type: 'Identifier' | 'PrivateIdentifier' } } } }
7172 */
7273 is_class_property_assignment_at_constructor_root ( node , path ) {
7374 if (
@@ -76,7 +77,8 @@ export class ClassAnalysis {
7677 node . operator === '=' &&
7778 node . left . type === 'MemberExpression' &&
7879 node . left . object . type === 'ThisExpression' &&
79- node . left . property . type === 'Identifier'
80+ ( node . left . property . type === 'Identifier' ||
81+ node . left . property . type === 'PrivateIdentifier' )
8082 )
8183 ) {
8284 return false ;
@@ -137,8 +139,8 @@ export class ClassAnalysis {
137139 if ( rune === null ) {
138140 return 'regular' ;
139141 }
140- if ( property_assignment_types . has ( rune ) ) {
141- return /** @type { PropertyAssignmentType } */ ( rune ) ;
142+ if ( is_state_creation_rune ( rune ) ) {
143+ return rune ;
142144 }
143145 // this does mean we return `regular` for some other runes (like `$trace` or `$state.raw`)
144146 // -- this is ok because the rune placement rules will throw if they're invalid.
0 commit comments