-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deoptimize all parameters when losing track of a function (#5158)
- Loading branch information
1 parent
801ffd1
commit 4e92d60
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const assert = require('node:assert'); | ||
|
||
module.exports = defineTest({ | ||
description: | ||
'respects variable mutations via unknown parameter values if we lose track of a function', | ||
exports({ test }) { | ||
assert.ok(test(state => (state.modified = true))); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function test(callback) { | ||
const state = { | ||
modified: false | ||
}; | ||
callback(state); | ||
if (state.modified) return true; | ||
return false; | ||
} |