@ -569,14 +569,22 @@ const instance_script = {
const declaration = reference . path . find ( ( el ) => el . type === 'VariableDeclaration' ) ;
const assignment = reference . path . find ( ( el ) => el . type === 'AssignmentExpression' ) ;
const update = reference . path . find ( ( el ) => el . type === 'UpdateExpression' ) ;
const labeled = reference . path . find (
( el ) => el . type === 'LabeledStatement' && el . label . name === '$'
const labeled = /** @type {LabeledStatement | undefined} */ (
reference . path . find ( ( el ) => el . type === 'LabeledStatement' && el . label . name === '$' )
) ;
if ( assignment && labeled ) {
if (
assignment &&
labeled &&
// ensure that $: foo = bar * 2 is not counted as a reassignment of bar
( labeled . body . type !== 'ExpressionStatement' ||
labeled . body . expression !== assignment ||
( assignment . left . type === 'Identifier' &&
assignment . left . name === binding . node . name ) )
) {
if ( assignment _in _labeled ) return false ;
assignment _in _labeled = /** @type {AssignmentExpression} */ ( assignment ) ;
labeled _statement = /** @type {LabeledStatement} */ ( labeled ) ;
labeled _statement = labeled ;
}
return (
@ -750,7 +758,12 @@ const instance_script = {
) ;
const bindings = ids . map ( ( id ) => state . scope . get ( id . name ) ) ;
const reassigned _bindings = bindings . filter ( ( b ) => b ? . reassigned ) ;
if ( reassigned _bindings . length === 0 && ! bindings . some ( ( b ) => b ? . kind === 'store_sub' ) ) {
if (
reassigned _bindings . length === 0 &&
! bindings . some ( ( b ) => b ? . kind === 'store_sub' ) &&
node . body . expression . left . type !== 'MemberExpression'
) {
let { start , end } = /** @type {{ start: number, end: number }} */ (
node . body . expression . right
) ;