Editorial: "a function object" -> "an ECMAScript function object" #3144
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.
This PR narrows "a function object" to "an ECMAScript function object" where appropriate.
(This is an expansion of #3138 (comment).)
I've split it into 2 commits to make it a bit easier to follow the propagation of narrowing, but they can probably be squashed for merging.
commit 1: Creating an ECMAScript function object
OrdinaryFunctionCreate returns an ECMAScript function object (EFO).
(1)
So, every operation that returns the result of OrdinaryFunctionCreate (i.e., every operation that creates a function for a FunctionBody or similar) also returns an EFO:
and, going one further level up,
(2)
A Record field that only ever holds the result of OrdinaryFunctionCreate holds an EFO:
commit 2: Calling an ECMAScript function object
By definition, 10.2.1 [[Call]] and 10.2.2 [[Construct]] only operate on EFOs.
From this, we know the following are only invoked on EFOs:
And, from the last,
And from that,
And from those,
Downstream specs: The only downstream reference to any of these things is HTML's use of
OrdinaryFunctionCreate
, and it doesn't care that we're narrowing the declared return type.