Skip to content

Commit 7b54734

Browse files
committed
fix(compiler): bind snapshot pattern for defaulted destructured parameters
Apply bindSnapshotPattern in the AssignmentPattern branch of visitParameters, matching the else branch. Without this, a destructured updater parameter with a default (e.g. ({ list } = fallback) =>) would not mark nested properties as snapshots, allowing in-place mutations to go unreported by OCTANE_STRONG_SNAPSHOT_MUTATION.
1 parent 8b735bf commit 7b54734

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎packages/octane/src/compiler/strong-mode.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,14 @@ export function analyzeStrongMode(ast, source, filename, options = {}) {
23232323
bindStateGetterPattern(parameter.left, value, parameterScope, bindGetter);
23242324
bindAmbientPattern(parameter.left, value, parameterScope, bindGetter);
23252325
if (value?.kind === 'prop') bindPropPattern(parameter.left, bindGetter);
2326+
if (value?.kind === 'snapshot' && parameter.left.type !== 'Identifier') {
2327+
bindSnapshotPattern(
2328+
parameter.left,
2329+
value,
2330+
bindGetter,
2331+
snapshotPatternProperty(parameterScope),
2332+
);
2333+
}
23262334
parameter = parameter.left;
23272335
} else {
23282336
visitPatternExpressions(parameter, parameterScope, phase, value?.kind === 'ref', value);

0 commit comments

Comments
 (0)