|
|
@@ -4219,7 +4219,20 @@ void ByteCodeGenerator::StartEmitFunction(ParseNode *pnodeFnc)
|
|
|
{
|
|
|
bodyScope->SetMustInstantiate(funcInfo->frameSlotsRegister != Js::Constants::NoRegister);
|
|
|
}
|
|
|
- paramScope->SetMustInstantiate(!pnodeFnc->sxFnc.IsBodyAndParamScopeMerged());
|
|
|
+
|
|
|
+ if (!pnodeFnc->sxFnc.IsBodyAndParamScopeMerged())
|
|
|
+ {
|
|
|
+ if (funcInfo->frameObjRegister != Js::Constants::NoRegister)
|
|
|
+ {
|
|
|
+ paramScope->SetMustInstantiate(true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // In the case of function expression being captured in the param scope the hasownlocalinclosure will be false for param scope,
|
|
|
+ // as function expression symbol stays in the function expression scope. We don't have to set mustinstantiate for param scope in that case.
|
|
|
+ paramScope->SetMustInstantiate(paramScope->GetHasOwnLocalInClosure());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|