|
|
@@ -1840,7 +1840,7 @@ FuncInfo *ByteCodeGenerator::FindEnclosingNonLambda()
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
-FuncInfo* GetParentFuncInfo(FuncInfo* child)
|
|
|
+FuncInfo* ByteCodeGenerator::GetParentFuncInfo(FuncInfo* child)
|
|
|
{
|
|
|
for (Scope* scope = child->GetBodyScope(); scope; scope = scope->GetEnclosingScope())
|
|
|
{
|
|
|
@@ -1853,6 +1853,19 @@ FuncInfo* GetParentFuncInfo(FuncInfo* child)
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
+FuncInfo* ByteCodeGenerator::GetEnclosingFuncInfo()
|
|
|
+{
|
|
|
+ FuncInfo* top = this->funcInfoStack->Pop();
|
|
|
+
|
|
|
+ Assert(!this->funcInfoStack->Empty());
|
|
|
+
|
|
|
+ FuncInfo* second = this->funcInfoStack->Top();
|
|
|
+
|
|
|
+ this->funcInfoStack->Push(top);
|
|
|
+
|
|
|
+ return second;
|
|
|
+}
|
|
|
+
|
|
|
bool ByteCodeGenerator::CanStackNestedFunc(FuncInfo * funcInfo, bool trace)
|
|
|
{
|
|
|
#if ENABLE_DEBUG_CONFIG_OPTIONS
|
|
|
@@ -2634,7 +2647,7 @@ void AssignFuncSymRegister(ParseNodeFnc * pnodeFnc, ByteCodeGenerator * byteCode
|
|
|
Assert(byteCodeGenerator->GetCurrentScope()->GetFunc() == sym->GetScope()->GetFunc());
|
|
|
if (byteCodeGenerator->GetCurrentScope()->GetFunc() != sym->GetScope()->GetFunc())
|
|
|
{
|
|
|
- Assert(GetParentFuncInfo(byteCodeGenerator->GetCurrentScope()->GetFunc()) == sym->GetScope()->GetFunc());
|
|
|
+ Assert(ByteCodeGenerator::GetParentFuncInfo(byteCodeGenerator->GetCurrentScope()->GetFunc()) == sym->GetScope()->GetFunc());
|
|
|
sym->GetScope()->SetMustInstantiate(true);
|
|
|
byteCodeGenerator->ProcessCapturedSym(sym);
|
|
|
sym->GetScope()->GetFunc()->SetHasLocalInClosure(true);
|