FunctionNode: remove existing definitions from scope immediately before adding new definitions for parsed function body (references #249)
Followup to bad8386b0555df1b6304cec79267d67ce56bc32f and 35eed62f13519c659e6346d26cca3f44afe3170f
Removing the definitions in analyze() when hasBeenParsed() is false, instead of in parseFunctionBody() before post processing still resulted in weird states where a scope might not contain any non-parameter local definitions. This change basically avoids removing any definitions unless those definitions are guaranteed to be immediately replaced because the function body is in the process of being re-parsed. This seems to fix the original assertion failure, and also seems to prevent scopes with no definitions.
1 file changed