[js-api] Fix misapplied ECMA-262 ReturnIfAbrupt shorthand (?, !) - #2256
Merged
Ms2ger merged 1 commit intoSep 30, 2026
Merged
Conversation
Two directions of the same underlying mistake - misreading what the ?/! shorthand actually requires: - [=!=] applied to ToJSValue (7 sites), OrdinaryObjectCreate (3 sites), CreateBuiltinFunction (1 site), and IsStrictlyEqual (2 sites): none of these ever return a Completion Record, so there is nothing for ! to unwrap. ToJSValue's own body is bare Let/Return statements with no Throw/NormalCompletion/ThrowCompletion anywhere; OrdinaryObjectCreate and CreateBuiltinFunction are declared with non-completion return types in ECMA-262; IsStrictlyEqual is declared ': a Boolean'. Every other call site of these same operations elsewhere in this corpus (~40 occurrences of CreateBuiltinFunction alone, in webidl/index.bs) correctly omits the shorthand - these are the sole exceptions. - read the imports is missing [=?=] before [$HasProperty$]: unlike every other [$HasProperty$]/[$Get$] call in this exact algorithm, which are all correctly marked [=?=], this one omission means the fallback branch it's meant to guard (falling back to reading from the plain importObject when a builtin-provided export doesn't have the requested property) can never fire, since the raw Completion Record it produces is compared against the literal false value as a Record, never true.
Ms2ger
approved these changes
Sep 30, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two directions of the same underlying mistake - misreading what the ?/! shorthand actually requires:
ToJSValue(7 sites),OrdinaryObjectCreate(3 sites),CreateBuiltinFunction(1 site), andIsStrictlyEqual(2 sites): none of these ever return a Completion Record, so there is nothing for ! to unwrap.ToJSValue's own body is bare Let/Return statements with no Throw / NormalCompletion / ThrowCompletion anywhere;OrdinaryObjectCreateandCreateBuiltinFunctionare declared with non-completion return types in ECMA-262;IsStrictlyEqualis declared with return type ': a Boolean'.read the importsis missing [=?=] beforeHasProperty: unlike every otherHasProperty/Getcall in this exact algorithm, which are all correctly marked [=?=].