Fix getContextClassName and getParentContextClassName

They both returned the late static bound class, not the context
class. This meant that eg "constant('self::FOO')" was actually
returning what "constant('static::FOO')" should have done.

In addition, we often want the Class*, not its name, so
change them to return Class*. The remaining places that then
read the name from the Class* should be fixed to use the Class*
directly (in a later diff).

Finally, noticed that while "defined()" was recently fixed to
support "static::", "constant()" was not. Pulled out a common
function to find the correct Class*.
Esse commit está contido em:
mwilliams
2013-03-22 09:51:57 -07:00
commit de Sara Golemon
commit 4c6cb0a577
8 arquivos alterados com 86 adições e 114 exclusões
+2 -2
Ver Arquivo
@@ -622,8 +622,6 @@ static Variant f_hphp_get_iterator(VRefParam iterable, bool isMutable) {
CREATE_VECTOR1(iterable));
}
if (iterable.isObject()) {
CStrRef context = g_vmContext->getContextClassName();
ObjectData *obj = iterable.getObjectData();
Variant iterator;
while (obj->instanceof(SystemLib::s_IteratorAggregateClass)) {
@@ -631,6 +629,8 @@ static Variant f_hphp_get_iterator(VRefParam iterable, bool isMutable) {
if (!iterator.isObject()) break;
obj = iterator.getObjectData();
}
VM::Class*ctx = g_vmContext->getContextClass();
CStrRef context = ctx ? ctx->nameRef() : empty_string;
if (isMutable) {
if (obj->instanceof(SystemLib::s_IteratorClass)) {
throw FatalErrorException("An iterator cannot be used for "