@@ -303,7 +303,9 @@ export function validate_binding(state, binding, expression) {
303
303
* @param {Expression } expression
304
304
*/
305
305
export function validate_mutation ( node , context , expression ) {
306
- const left = node . type === 'AssignmentExpression' ? node . left : node . argument ;
306
+ let left = /** @type {Expression | Super } */ (
307
+ node . type === 'AssignmentExpression' ? node . left : node . argument
308
+ ) ;
307
309
308
310
if ( ! dev || left . type !== 'MemberExpression' || is_ignored ( node , 'ownership_invalid_mutation' ) ) {
309
311
return expression ;
@@ -316,27 +318,25 @@ export function validate_mutation(node, context, expression) {
316
318
if ( binding ?. kind !== 'prop' && binding ?. kind !== 'bindable_prop' ) return expression ;
317
319
318
320
const state = /** @type {ComponentClientTransformState } */ ( context . state ) ;
319
-
320
321
state . analysis . needs_mutation_validation = true ;
321
322
322
323
/** @type {Array<Identifier | Literal> } */
323
324
const path = [ ] ;
324
- /** @type {Expression | Super } */
325
- let current = left ;
326
-
327
- while ( current . type === 'MemberExpression' ) {
328
- if ( current . property . type === 'Literal' ) {
329
- path . unshift ( current . property ) ;
330
- } else if ( current . property . type === 'Identifier' ) {
331
- if ( current . computed ) {
332
- path . unshift ( current . property ) ;
325
+
326
+ while ( left . type === 'MemberExpression' ) {
327
+ if ( left . property . type === 'Literal' ) {
328
+ path . unshift ( left . property ) ;
329
+ } else if ( left . property . type === 'Identifier' ) {
330
+ if ( left . computed ) {
331
+ path . unshift ( left . property ) ;
333
332
} else {
334
- path . unshift ( b . literal ( current . property . name ) ) ;
333
+ path . unshift ( b . literal ( left . property . name ) ) ;
335
334
}
336
335
} else {
337
336
return expression ;
338
337
}
339
- current = current . object ;
338
+
339
+ left = left . object ;
340
340
}
341
341
342
342
path . unshift ( b . literal ( name . name ) ) ;
0 commit comments