Support Annex B.3.3
arai-a opened this issue · comments
arai-a commented
https://tc39.es/ecma262/#sec-block-level-function-declarations-web-legacy-compatibility-semantics
To achieve this:
- when visiting a function inside a block
- mark the as possibly-annex
- when leaving a scope
- propagate the list of possibly-annex functions to enclosing scope
- currently, at this point, the function is converted into an element of
LexicalScopeData.base.bindings
- the list should contain:
ScopeIndex
for the scope- the index of the function in
BaseScopeData.bindings
FunctionStencilIndex
for the function- map from
SourceAtomSetIndex
to function
- =>
HashMap<SourceAtomSetIndex, Vec<(ScopeIndex, usize, FunctionStencilIndex)>>
?
- currently, at this point, the function is converted into an element of
- propagate the list of possibly-annex functions to enclosing scope
- when leaving a scope that can conflict with
var
- if there's any conflicting declarations, remove the function from the list of possibly-annex functions
- when leaving a
var
scope- makr all possibly-annex functions annex
- this needs modification to elements in
LexicalScopeData.base.bindings
- also, modify
FunctionStencil
for those functions, to mark annex - append the function to
GlobalScopeData.functions
- this needs modification to elements in
- makr all possibly-annex functions annex
At the same time, it would be better to stop using AssociatedDataKey
, but use FunctionStencilIndex
instead, to identify functions.
arai-a commented
wait, I guess I was using "hoisted" in wrong meaning here