diff --git a/lib/Backend/IRBuilder.cpp b/lib/Backend/IRBuilder.cpp index 099999b6d11..22a3cdbf1ac 100644 --- a/lib/Backend/IRBuilder.cpp +++ b/lib/Backend/IRBuilder.cpp @@ -414,7 +414,7 @@ IRBuilder::Build() m_func->m_tailInstr = m_func->m_exitInstr; m_func->m_headInstr->InsertAfter(m_func->m_tailInstr); - if (m_func->GetJITFunctionBody()->IsParamAndBodyScopeMerged()) + if (m_func->GetJITFunctionBody()->IsParamAndBodyScopeMerged() || this->IsLoopBody()) { this->SetParamScopeDone(); } diff --git a/test/Bugs/bug14057294.js b/test/Bugs/bug14057294.js new file mode 100644 index 00000000000..1af3950947d --- /dev/null +++ b/test/Bugs/bug14057294.js @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------------------------------- +// Copyright (C) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +//------------------------------------------------------------------------------------------------------- + +function foo(a, b = (function() {a;})()) +{ + for (var ii = 0; ii < 200; ++ii) + { + var c, d = null; + function bar() + { + c; + d; + }; + bar(); + } +}; + +foo(); + +WScript.Echo("Pass") diff --git a/test/Bugs/rlexe.xml b/test/Bugs/rlexe.xml index 744e45f82c0..8e884dd2e43 100644 --- a/test/Bugs/rlexe.xml +++ b/test/Bugs/rlexe.xml @@ -440,4 +440,9 @@ -args summary -endargs + + + bug14057294.js + +