Make arrays implement Traversable and KeyedTraversable

This diff changes HHVM so that arrays are considered to implement the
Traversable and KeyedTraversable interfaces (which have no methods).

The idea is that these interfaces will be useful for parameter type
constraints for PHP code that wants to be compatible with both arrays and
collections (and possibly other objects that implement these interfaces).
Esse commit está contido em:
Drew Paroski
2013-04-19 17:00:01 -07:00
commit de Sara Golemon
commit 89765cd4f2
13 arquivos alterados com 136 adições e 45 exclusões
-12
Ver Arquivo
@@ -574,18 +574,6 @@ void FunctionScope::setPerfectVirtual() {
}
}
bool FunctionScope::needsTypeCheckWrapper() const {
for (int i = 0; i < m_maxParam; i++) {
if (isRefParam(i)) continue;
if (TypePtr spec = m_paramTypeSpecs[i]) {
if (Type::SameType(spec, m_paramTypes[i])) {
return true;
}
}
}
return false;
}
bool FunctionScope::needsClassParam() {
if (!isStatic()) return false;
ClassScopeRawPtr cls = getContainingClass();