String HHVM_METHOD(Generator, getCalledClass) { Generator* gen = Native::data<Generator>(this_); String called_class; if (gen->actRec()->hasThis()) { called_class = gen->actRec()->getThis()->getVMClass()->name()->data(); } else if (gen->actRec()->hasClass()) { called_class = gen->actRec()->getClass()->name()->data(); } else { called_class = empty_string(); } return called_class; }
String HHVM_METHOD(Generator, getOrigFuncName) { Generator* gen = Native::data<Generator>(this_); const Func* origFunc = gen->actRec()->func(); auto const origName = origFunc->isClosureBody() ? s__closure_.get() : origFunc->name(); assert(origName->isStatic()); return String(const_cast<StringData*>(origName)); }