This modifies the scope pass to build FunctionStencil, for all functions.
FunctionStencil built by this contains the following information, with tree structure:
function name
source location for the function (some case isn't supported properly)
inner functions
closed over bindings
script flags (has rest)
Given that the scope pass is going to be merged to the first (parse) pass, this part also uses callback style for each position/node.
So, even if AST parameter contains all information, it doesn't use the info until visiting the node.
(for example, source location is partially initialized when entering a function, and remaining part is intialized when leaving the function)
Currently, the plan is to support all functions as lazy, so this builds lazy function stencil for all functions.
(when we support non-lazy function, some calculation will become redundant)
Emitter is also modified to emit lazy function, but it's disabled, given closed over bindings isn't supported yet.
This modifies the scope pass to build
FunctionStencil
, for all functions.FunctionStencil
built by this contains the following information, with tree structure:Given that the scope pass is going to be merged to the first (parse) pass, this part also uses callback style for each position/node. So, even if AST parameter contains all information, it doesn't use the info until visiting the node. (for example, source location is partially initialized when entering a function, and remaining part is intialized when leaving the function)
Currently, the plan is to support all functions as lazy, so this builds lazy function stencil for all functions. (when we support non-lazy function, some calculation will become redundant)
Emitter is also modified to emit lazy function, but it's disabled, given closed over bindings isn't supported yet.