Fix names of closures in pseudoMains

The classes were all called Closure$, with the result that attempting
to instantiate one closure could instantiate a different one.
Esse commit está contido em:
mwilliams
2013-06-28 11:58:55 -07:00
commit de Sara Golemon
commit 60a17c5e24
+8
Ver Arquivo
@@ -3873,6 +3873,14 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) {
// The parser generated a unique name for the function,
// use that for the class
std::string clsName = ce->getClosureFunction()->getOriginalName();
if (m_curFunc->isPseudoMain()) {
std::ostringstream oss;
oss << clsName << '$' << std::hex <<
m_curFunc->ue().md5().q[1] << m_curFunc->ue().md5().q[0] << '$';
clsName = oss.str();
}
StringData* className = StringData::GetStaticString(clsName);
// We're still at the closure definition site. Emit code to instantiate