diff --git a/hphp/runtime/vm/translator/hopt/codegen.cpp b/hphp/runtime/vm/translator/hopt/codegen.cpp index 2786550a2..6229746a4 100644 --- a/hphp/runtime/vm/translator/hopt/codegen.cpp +++ b/hphp/runtime/vm/translator/hopt/codegen.cpp @@ -4035,9 +4035,10 @@ void CodeGenerator::emitGetCtxFwdCallWithThis(PhysReg ctxReg, } /** - * This method is similar to emitGetCtxFwdCallWithThis above, - * but whether or not the callee is a static method is uknown at JIT time, - * and that is determined dynamically by looking up into the StaticMethodFCache. + * This method is similar to emitGetCtxFwdCallWithThis above, but + * whether or not the callee is a static method is unknown at JIT + * time, and that is determined dynamically by looking up into the + * StaticMethodFCache. */ void CodeGenerator::emitGetCtxFwdCallWithThisDyn(PhysReg destCtxReg, PhysReg thisReg, diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp index ef75f8db9..f2091f76f 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp @@ -550,7 +550,7 @@ void HhbcTranslator::emitLateBoundCls() { void HhbcTranslator::emitSelf() { Class* clss = getCurClass(); - if (clss == NULL) { + if (clss == nullptr) { emitInterpOne(Type::Cls, 0); } else { push(m_tb->genDefConst(clss)); @@ -558,8 +558,8 @@ void HhbcTranslator::emitSelf() { } void HhbcTranslator::emitParent() { - const Class* clss = getCurClass()->parent(); - if (clss == NULL || clss->parent() == NULL) { + auto const clss = getCurClass(); + if (clss == nullptr || clss->parent() == nullptr) { emitInterpOne(Type::Cls, 0); } else { push(m_tb->genDefConst(clss->parent())); diff --git a/hphp/test/slow/traits/hhir_parent.php b/hphp/test/slow/traits/hhir_parent.php new file mode 100644 index 000000000..0231c3982 --- /dev/null +++ b/hphp/test/slow/traits/hhir_parent.php @@ -0,0 +1,31 @@ +foo(); +} + +foo(); diff --git a/hphp/test/slow/traits/hhir_parent.php.expect b/hphp/test/slow/traits/hhir_parent.php.expect new file mode 100644 index 000000000..178481050 --- /dev/null +++ b/hphp/test/slow/traits/hhir_parent.php.expect @@ -0,0 +1 @@ +D