Add items(), keys(), and fromItems() APIs for collections

Esse commit está contido em:
andrewparoski
2013-03-13 21:49:55 -07:00
commit de Sara Golemon
commit bb2df58a2f
13 arquivos alterados com 1119 adições e 70 exclusões
+67
Ver Arquivo
@@ -2221,6 +2221,73 @@ interface Awaitable {
public function getWaitHandle();
}
class KeysIterator implements Iterator {
public $it;
public function __construct($it) {
$this->it = $it;
}
public function rewind() {
$this->it->rewind();
}
public function valid() {
return $this->it->valid();
}
public function next() {
$this->it->next();
}
public function key() {
throw new RuntimeException(
"Call to undefined method KeysIterator::keys()");
}
public function current() {
return $this->it->key();
}
}
class KeysIterable implements Iterable {
public $it;
public function __construct($iterable) {
$this->it = new KeysIterator($iterable->getIterator());
}
public function getIterator() {
return clone $this->it;
}
}
class MapItemsIterator implements Iterator {
public $it;
public function __construct($it) {
$this->it = $it;
}
public function rewind() {
$this->it->rewind();
}
public function valid() {
return $this->it->valid();
}
public function next() {
$this->it->next();
}
public function key() {
throw new RuntimeException(
"Call to undefined method MapItemsIterator::keys()");
}
public function current() {
return Tuple {$this->it->key(), $this->it->current()};
}
}
class MapItemsIterable implements Iterable {
public $it;
public function __construct($iterable) {
$this->it = new MapItemsIterator($iterable->getIterator());
}
public function getIterator() {
return clone $this->it;
}
}
interface DebuggerCommand {
/**
* Called when DebuggerClient needs to auto-complete. Inside this function,
+1
Ver Arquivo
@@ -100,6 +100,7 @@ const char *BuiltinSymbols::SystemClasses[] = {
"exception",
"arrayaccess",
"iterator",
"collections",
"reflection",
"splobjectstorage",
"directory",
+171 -32
Ver Arquivo
@@ -105,6 +105,9 @@ EOT
DefineFunction(
array(
'name' => "__construct",
'flags' => HasDocComment,
'desc' => "Returns a Vector built from the values produced by the ".
"specified Iterable.",
'return' => array(
'type' => null,
),
@@ -137,6 +140,27 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "items",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the values from this ".
"Vector.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "keys",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the keys from this Vector.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "at",
@@ -324,7 +348,7 @@ DefineFunction(
array(
'name' => "toArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the values from this Vector.",
'desc' => "Returns an array built from the values from this Vector.",
'return' => array(
'type' => VariantMap,
),
@@ -495,12 +519,29 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "fromItems",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a Vector built from the values produced by the ".
"specified Iterable.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "fromArray",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a Vector containing the values from the " .
"specified array.",
'desc' => "Returns a Vector built from the values from the specified ".
"array.",
'return' => array(
'type' => Object,
),
@@ -532,7 +573,7 @@ DefineFunction(
array(
'name' => "slice",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a Vector containing the specified slice of values ".
'desc' => "Returns a Vector built from the specified slice of values ".
"from the specified Vector.",
'return' => array(
'type' => Object,
@@ -640,6 +681,9 @@ BeginClass(
DefineFunction(
array(
'name' => "__construct",
'flags' => HasDocComment,
'desc' => "Returns a Map built from the keys and values produced by ".
"the specified KeyedIterable.",
'return' => array(
'type' => null,
),
@@ -672,6 +716,27 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "items",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the key/value pairs as ".
"Tuples from this Map.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "keys",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the keys from this Map.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "at",
@@ -830,7 +895,7 @@ DefineFunction(
array(
'name' => "toArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the key/value pairs from this ".
'desc' => "Returns an array built from the keys and values from this ".
"Map.",
'return' => array(
'type' => VariantMap,
@@ -842,7 +907,7 @@ DefineFunction(
array(
'name' => "copyAsArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the key/value pairs from this ".
'desc' => "Returns an array built from the keys and values from this ".
"Map.",
'return' => array(
'type' => VariantMap,
@@ -853,8 +918,7 @@ DefineFunction(
array(
'name' => "toKeysArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the keys from this ".
"Map.",
'desc' => "Returns an array built from the keys from this Map.",
'return' => array(
'type' => VariantMap,
),
@@ -864,8 +928,7 @@ DefineFunction(
array(
'name' => "values",
'flags' => HasDocComment,
'desc' => "Returns a Vector containing the values from this ".
"Map.",
'desc' => "Returns a Vector built from the values from this Map.",
'return' => array(
'type' => Object,
),
@@ -875,8 +938,7 @@ DefineFunction(
array(
'name' => "toValuesArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the values from this ".
"Map.",
'desc' => "Returns an array built from the values from this Map.",
'return' => array(
'type' => VariantMap,
),
@@ -886,7 +948,7 @@ DefineFunction(
array(
'name' => "updateFromArray",
'flags' => HasDocComment,
'desc' => "Inserts the key/value pairs from the specified array into ".
'desc' => "Inserts the keys and values from the specified array into ".
"this Map.",
'return' => array(
'type' => Object,
@@ -903,8 +965,8 @@ DefineFunction(
array(
'name' => "updateFromIterable",
'flags' => HasDocComment,
'desc' => "Inserts the key/value pairs produced by the specified ".
"Iterable.",
'desc' => "Inserts the keys and values produced by the specified ".
"KeyedIterable.",
'return' => array(
'type' => Object,
),
@@ -1013,11 +1075,28 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "fromItems",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a Map built from the key/value Tuples produced by ".
"the specified Iterable.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "fromArray",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a Map containing the key/value pairs from the " .
'desc' => "Returns a Map built from the keys and values from the " .
"specified array.",
'return' => array(
'type' => Object,
@@ -1034,8 +1113,8 @@ DefineFunction(
array(
'name' => "fromIterable",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a Map containing the key/value pairs produced by ".
"the specified Iterable.",
'desc' => "Returns a Map built from the keys and values produced by ".
"the specified KeyedIterable.",
'return' => array(
'type' => Object,
),
@@ -1133,6 +1212,9 @@ BeginClass(
DefineFunction(
array(
'name' => "__construct",
'flags' => HasDocComment,
'desc' => "Returns a StableMap built from the keys and values produced ".
"by the specified KeyedIterable.",
'return' => array(
'type' => null,
),
@@ -1165,6 +1247,28 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "items",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the key/value pairs as ".
"Tuples from this StableMap.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "keys",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the keys from this ".
"StableMap.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "at",
@@ -1323,7 +1427,7 @@ DefineFunction(
array(
'name' => "toArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the key/value pairs from this ".
'desc' => "Returns an array built from the keys and values from this ".
"StableMap.",
'return' => array(
'type' => VariantMap,
@@ -1335,7 +1439,7 @@ DefineFunction(
array(
'name' => "copyAsArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the key/value pairs from this ".
'desc' => "Returns an array built from the keys and values from this ".
"StableMap.",
'return' => array(
'type' => VariantMap,
@@ -1346,8 +1450,7 @@ DefineFunction(
array(
'name' => "toKeysArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the keys from this ".
"StableMap.",
'desc' => "Returns an array built from the keys from this StableMap.",
'return' => array(
'type' => VariantMap,
),
@@ -1357,8 +1460,7 @@ DefineFunction(
array(
'name' => "values",
'flags' => HasDocComment,
'desc' => "Returns a Vector containing the values from this ".
"StableMap.",
'desc' => "Returns a Vector built from the values from this StableMap.",
'return' => array(
'type' => Object,
),
@@ -1368,8 +1470,7 @@ DefineFunction(
array(
'name' => "toValuesArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the values from this ".
"StableMap.",
'desc' => "Returns an array built from the values from this StableMap.",
'return' => array(
'type' => VariantMap,
),
@@ -1396,8 +1497,8 @@ DefineFunction(
array(
'name' => "updateFromIterable",
'flags' => HasDocComment,
'desc' => "Inserts the key/value pairs produced by the specified ".
"Iterable.",
'desc' => "Inserts the keys and values produced by the specified ".
"KeyedIterable.",
'return' => array(
'type' => Object,
),
@@ -1499,6 +1600,23 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "fromItems",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a StableMap built from the key/value Tuples produced ".
"by the specified Iterable.",
'return' => array(
'type' => Object,
),
'args' => array(
array(
'name' => "iterable",
'type' => Variant,
),
),
));
DefineFunction(
array(
'name' => "__toString",
@@ -1511,7 +1629,7 @@ DefineFunction(
array(
'name' => "fromArray",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a StableMap containing the key/value pairs from the ".
'desc' => "Returns a StableMap built from the keys and values from the ".
"specified array.",
'return' => array(
'type' => Object,
@@ -1528,8 +1646,8 @@ DefineFunction(
array(
'name' => "fromIterable",
'flags' => IsStatic | HasDocComment,
'desc' => "Returns a StableMap containing the key/value pairs produced ".
"by the specified Iterable.",
'desc' => "Returns a StableMap built from the keys and values produced ".
"by the specified KeyedIterable.",
'return' => array(
'type' => Object,
),
@@ -1659,11 +1777,32 @@ DefineFunction(
),
));
DefineFunction(
array(
'name' => "items",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the values from this ".
"Tuple.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "keys",
'flags' => HasDocComment,
'desc' => "Returns an Iterable that produces the keys from this Tuple.",
'return' => array(
'type' => Object,
),
));
DefineFunction(
array(
'name' => "toArray",
'flags' => HasDocComment,
'desc' => "Returns an array containing the values from this Tuple.",
'desc' => "Returns an array built from the values from this Tuple.",
'return' => array(
'type' => VariantMap,
),
+138 -4
Ver Arquivo
@@ -21,6 +21,7 @@
#include <runtime/ext/ext_array.h>
#include <runtime/ext/ext_math.h>
#include <runtime/ext/ext_intl.h>
#include <system/lib/systemlib.h>
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
@@ -269,6 +270,14 @@ int64_t c_Vector::t_count() {
return m_size;
}
Object c_Vector::t_items() {
return this;
}
Object c_Vector::t_keys() {
return SystemLib::AllocKeysIterableObject(this);
}
Variant c_Vector::t_at(CVarRef key) {
if (key.isInteger()) {
return tvAsCVarRef(at(key.toInt64()));
@@ -473,19 +482,38 @@ Object c_Vector::t_put(CVarRef key, CVarRef value) {
return t_set(key, value);
}
Object c_Vector::ti_fromitems(const char* cls, CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
c_Vector* target;
Object ret = target = NEWOBJ(c_Vector)();
if (sz) {
target->reserve(sz);
}
for (uint i = 0; iter; ++i, ++iter) {
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
target->add(tv);
}
return ret;
}
Object c_Vector::ti_fromarray(const char* cls, CVarRef arr) {
if (!arr.isArray()) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Parameter arr must be an array"));
throw e;
}
c_Vector* vec;
Object ret = vec = NEWOBJ(c_Vector)();
c_Vector* target;
Object ret = target = NEWOBJ(c_Vector)();
ArrayData* ad = arr.getArrayData();
uint sz = ad->size();
vec->m_capacity = vec->m_size = sz;
target->m_capacity = target->m_size = sz;
TypedValue* data;
vec->m_data = data = (TypedValue*)smart_malloc(sz * sizeof(TypedValue));
target->m_data = data = (TypedValue*)smart_malloc(sz * sizeof(TypedValue));
ssize_t pos = ad->iter_begin();
for (uint i = 0; i < sz; ++i, pos = ad->iter_advance(pos)) {
assert(pos != ArrayData::invalid_index);
@@ -942,6 +970,14 @@ int64_t c_Map::t_count() {
return m_size;
}
Object c_Map::t_items() {
return SystemLib::AllocMapItemsIterableObject(this);
}
Object c_Map::t_keys() {
return SystemLib::AllocKeysIterableObject(this);
}
Variant c_Map::t_at(CVarRef key) {
if (key.isInteger()) {
return tvAsCVarRef(at(key.toInt64()));
@@ -1187,6 +1223,47 @@ Object c_Map::t_getiterator() {
return it;
}
Object c_Map::ti_fromitems(const char* cls, CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
c_Map* target;
Object ret = target = NEWOBJ(c_Map)();
if (sz) {
target->reserve(sz);
}
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
if (UNLIKELY(tv->m_type != KindOfObject ||
!tv->m_data.pobj->instanceof(c_Tuple::s_cls))) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Parameter must be an instance of Iterable<Tuple>"));
throw e;
}
auto tup = static_cast<c_Tuple*>(tv->m_data.pobj);
if (UNLIKELY(tup->t_count() != 2)) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Expected Tuples containing exactly two elements"));
throw e;
}
TypedValue* tvKey = &tup->getData()[0];
TypedValue* tvValue = &tup->getData()[1];
assert(tvKey->m_type != KindOfRef);
assert(tvValue->m_type != KindOfRef);
if (tvKey->m_type == KindOfInt64) {
target->update(tvKey->m_data.num, tvValue);
} else if (IS_STRING_TYPE(tvKey->m_type)) {
target->update(tvKey->m_data.pstr, tvValue);
} else {
throwBadKeyType();
}
}
return ret;
}
Object c_Map::ti_fromarray(const char* cls, CVarRef arr) {
if (!arr.isArray()) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
@@ -1865,6 +1942,14 @@ int64_t c_StableMap::t_count() {
return m_size;
}
Object c_StableMap::t_items() {
return SystemLib::AllocMapItemsIterableObject(this);
}
Object c_StableMap::t_keys() {
return SystemLib::AllocKeysIterableObject(this);
}
Variant c_StableMap::t_at(CVarRef key) {
if (key.isInteger()) {
return tvAsCVarRef(at(key.toInt64()));
@@ -2099,6 +2184,47 @@ Object c_StableMap::t_getiterator() {
return it;
}
Object c_StableMap::ti_fromitems(const char* cls, CVarRef iterable) {
size_t sz;
ArrayIter iter = getArrayIterHelper(iterable, sz);
c_StableMap* target;
Object ret = target = NEWOBJ(c_StableMap)();
if (sz) {
target->reserve(sz);
}
for (; iter; ++iter) {
Variant v = iter.second();
TypedValue* tv = (TypedValue*)(&v);
if (UNLIKELY(tv->m_type == KindOfRef)) {
tv = tv->m_data.pref->tv();
}
if (UNLIKELY(tv->m_type != KindOfObject ||
!tv->m_data.pobj->instanceof(c_Tuple::s_cls))) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Parameter must be an instance of Iterable<Tuple>"));
throw e;
}
auto tup = static_cast<c_Tuple*>(tv->m_data.pobj);
if (UNLIKELY(tup->t_count() != 2)) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Expected Tuples containing exactly two elements"));
throw e;
}
TypedValue* tvKey = &tup->getData()[0];
TypedValue* tvValue = &tup->getData()[1];
assert(tvKey->m_type != KindOfRef);
assert(tvValue->m_type != KindOfRef);
if (tvKey->m_type == KindOfInt64) {
target->update(tvKey->m_data.num, tvValue);
} else if (IS_STRING_TYPE(tvKey->m_type)) {
target->update(tvKey->m_data.pstr, tvValue);
} else {
throwBadKeyType();
}
}
return ret;
}
Object c_StableMap::ti_fromarray(const char* cls, CVarRef arr) {
if (!arr.isArray()) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
@@ -2772,6 +2898,14 @@ int64_t c_Tuple::t_count() {
return m_size;
}
Object c_Tuple::t_items() {
return this;
}
Object c_Tuple::t_keys() {
return SystemLib::AllocKeysIterableObject(this);
}
Variant c_Tuple::t_at(CVarRef key) {
if (key.isInteger()) {
return tvAsCVarRef(at(key.toInt64()));
+406
Ver Arquivo
@@ -144,6 +144,82 @@ TypedValue* tg_6Vector_count(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Vector::t_items()
_ZN4HPHP8c_Vector7t_itemsEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_6Vector_items(Value* _rv, ObjectData* this_) asm("_ZN4HPHP8c_Vector7t_itemsEv");
TypedValue* tg_6Vector_items(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_6Vector_items((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("Vector::items", 0, 1);
}
} else {
throw_instance_method_fatal("Vector::items");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Vector::t_keys()
_ZN4HPHP8c_Vector6t_keysEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_6Vector_keys(Value* _rv, ObjectData* this_) asm("_ZN4HPHP8c_Vector6t_keysEv");
TypedValue* tg_6Vector_keys(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_6Vector_keys((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("Vector::keys", 0, 1);
}
} else {
throw_instance_method_fatal("Vector::keys");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Variant HPHP::c_Vector::t_at(HPHP::Variant const&)
_ZN4HPHP8c_Vector4t_atERKNS_7VariantE
@@ -1021,6 +1097,40 @@ TypedValue* tg_6Vector___unset(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Vector::ti_fromitems(char const*, HPHP::Variant const&)
_ZN4HPHP8c_Vector12ti_fromitemsEPKcRKNS_7VariantE
(return value) => rax
_rv => rdi
cls_ => rsi
iterable => rdx
*/
Value* th_6Vector_fromItems(Value* _rv, char const* cls_, TypedValue* iterable) asm("_ZN4HPHP8c_Vector12ti_fromitemsEPKcRKNS_7VariantE");
TypedValue* tg_6Vector_fromItems(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 1LL) {
rv.m_type = KindOfObject;
th_6Vector_fromItems((Value*)(&(rv)), ("Vector"), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("Vector::fromItems", count, 1, 1, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Vector::ti_fromarray(char const*, HPHP::Variant const&)
_ZN4HPHP8c_Vector12ti_fromarrayEPKcRKNS_7VariantE
@@ -1474,6 +1584,82 @@ TypedValue* tg_3Map_count(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Map::t_items()
_ZN4HPHP5c_Map7t_itemsEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_3Map_items(Value* _rv, ObjectData* this_) asm("_ZN4HPHP5c_Map7t_itemsEv");
TypedValue* tg_3Map_items(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_3Map_items((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("Map::items", 0, 1);
}
} else {
throw_instance_method_fatal("Map::items");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Map::t_keys()
_ZN4HPHP5c_Map6t_keysEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_3Map_keys(Value* _rv, ObjectData* this_) asm("_ZN4HPHP5c_Map6t_keysEv");
TypedValue* tg_3Map_keys(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_3Map_keys((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("Map::keys", 0, 1);
}
} else {
throw_instance_method_fatal("Map::keys");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Variant HPHP::c_Map::t_at(HPHP::Variant const&)
_ZN4HPHP5c_Map4t_atERKNS_7VariantE
@@ -2357,6 +2543,40 @@ TypedValue* tg_3Map___unset(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Map::ti_fromitems(char const*, HPHP::Variant const&)
_ZN4HPHP5c_Map12ti_fromitemsEPKcRKNS_7VariantE
(return value) => rax
_rv => rdi
cls_ => rsi
iterable => rdx
*/
Value* th_3Map_fromItems(Value* _rv, char const* cls_, TypedValue* iterable) asm("_ZN4HPHP5c_Map12ti_fromitemsEPKcRKNS_7VariantE");
TypedValue* tg_3Map_fromItems(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 1LL) {
rv.m_type = KindOfObject;
th_3Map_fromItems((Value*)(&(rv)), ("Map"), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("Map::fromItems", count, 1, 1, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Map::ti_fromarray(char const*, HPHP::Variant const&)
_ZN4HPHP5c_Map12ti_fromarrayEPKcRKNS_7VariantE
@@ -2773,6 +2993,82 @@ TypedValue* tg_9StableMap_count(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_StableMap::t_items()
_ZN4HPHP11c_StableMap7t_itemsEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_9StableMap_items(Value* _rv, ObjectData* this_) asm("_ZN4HPHP11c_StableMap7t_itemsEv");
TypedValue* tg_9StableMap_items(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_9StableMap_items((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("StableMap::items", 0, 1);
}
} else {
throw_instance_method_fatal("StableMap::items");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_StableMap::t_keys()
_ZN4HPHP11c_StableMap6t_keysEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_9StableMap_keys(Value* _rv, ObjectData* this_) asm("_ZN4HPHP11c_StableMap6t_keysEv");
TypedValue* tg_9StableMap_keys(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_9StableMap_keys((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("StableMap::keys", 0, 1);
}
} else {
throw_instance_method_fatal("StableMap::keys");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Variant HPHP::c_StableMap::t_at(HPHP::Variant const&)
_ZN4HPHP11c_StableMap4t_atERKNS_7VariantE
@@ -3618,6 +3914,40 @@ TypedValue* tg_9StableMap___unset(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_StableMap::ti_fromitems(char const*, HPHP::Variant const&)
_ZN4HPHP11c_StableMap12ti_fromitemsEPKcRKNS_7VariantE
(return value) => rax
_rv => rdi
cls_ => rsi
iterable => rdx
*/
Value* th_9StableMap_fromItems(Value* _rv, char const* cls_, TypedValue* iterable) asm("_ZN4HPHP11c_StableMap12ti_fromitemsEPKcRKNS_7VariantE");
TypedValue* tg_9StableMap_fromItems(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 1LL) {
rv.m_type = KindOfObject;
th_9StableMap_fromItems((Value*)(&(rv)), ("StableMap"), (args-0));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("StableMap::fromItems", count, 1, 1, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::String HPHP::c_StableMap::t___tostring()
_ZN4HPHP11c_StableMap12t___tostringEv
@@ -4070,6 +4400,82 @@ TypedValue* tg_5Tuple_count(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Tuple::t_items()
_ZN4HPHP7c_Tuple7t_itemsEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_5Tuple_items(Value* _rv, ObjectData* this_) asm("_ZN4HPHP7c_Tuple7t_itemsEv");
TypedValue* tg_5Tuple_items(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_5Tuple_items((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("Tuple::items", 0, 1);
}
} else {
throw_instance_method_fatal("Tuple::items");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Object HPHP::c_Tuple::t_keys()
_ZN4HPHP7c_Tuple6t_keysEv
(return value) => rax
_rv => rdi
this_ => rsi
*/
Value* th_5Tuple_keys(Value* _rv, ObjectData* this_) asm("_ZN4HPHP7c_Tuple6t_keysEv");
TypedValue* tg_5Tuple_keys(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
ObjectData* this_ = (ar->hasThis() ? ar->getThis() : NULL);
if (this_) {
if (count == 0LL) {
rv.m_type = KindOfObject;
th_5Tuple_keys((Value*)(&(rv)), (this_));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("Tuple::keys", 0, 1);
}
} else {
throw_instance_method_fatal("Tuple::keys");
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
frame_free_locals_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Array HPHP::c_Tuple::t_toarray()
_ZN4HPHP7c_Tuple9t_toarrayEv
+22 -2
Ver Arquivo
@@ -53,6 +53,8 @@ class c_Vector : public ExtObjectDataFlags<ObjectData::VectorAttrInit|
public: Object t_clear();
public: bool t_isempty();
public: int64_t t_count();
public: Object t_items();
public: Object t_keys();
public: Variant t_at(CVarRef key);
public: Variant t_get(CVarRef key);
public: Object t_set(CVarRef key, CVarRef value);
@@ -72,6 +74,10 @@ class c_Vector : public ExtObjectDataFlags<ObjectData::VectorAttrInit|
public: Variant t___set(Variant name, Variant value);
public: bool t___isset(Variant name);
public: Variant t___unset(Variant name);
public: static Object ti_fromitems(const char* cls, CVarRef iterable);
public: static Object t_fromitems(CVarRef iterable) {
return ti_fromitems("vector", iterable);
}
public: static Object ti_fromarray(const char* cls, CVarRef arr);
public: static Object t_fromarray(CVarRef arr) {
return ti_fromarray("vector", arr);
@@ -221,6 +227,8 @@ class c_Map : public ExtObjectDataFlags<ObjectData::MapAttrInit|
public: Object t_clear();
public: bool t_isempty();
public: int64_t t_count();
public: Object t_items();
public: Object t_keys();
public: Variant t_at(CVarRef key);
public: Variant t_get(CVarRef key);
public: Object t_set(CVarRef key, CVarRef value);
@@ -243,6 +251,10 @@ class c_Map : public ExtObjectDataFlags<ObjectData::MapAttrInit|
public: Variant t___set(Variant name, Variant value);
public: bool t___isset(Variant name);
public: Variant t___unset(Variant name);
public: static Object ti_fromitems(const char* cls, CVarRef iterable);
public: static Object t_fromitems(CVarRef iterable) {
return ti_fromitems("map", iterable);
}
public: static Object ti_fromarray(const char* cls, CVarRef arr);
public: static Object t_fromarray(CVarRef arr) {
return ti_fromarray("map", arr);
@@ -508,6 +520,8 @@ class c_StableMap : public ExtObjectDataFlags<ObjectData::StableMapAttrInit|
public: Object t_clear();
public: bool t_isempty();
public: int64_t t_count();
public: Object t_items();
public: Object t_keys();
public: Variant t_at(CVarRef key);
public: Variant t_get(CVarRef key);
public: Object t_set(CVarRef key, CVarRef value);
@@ -530,13 +544,17 @@ class c_StableMap : public ExtObjectDataFlags<ObjectData::StableMapAttrInit|
public: Variant t___set(Variant name, Variant value);
public: bool t___isset(Variant name);
public: Variant t___unset(Variant name);
public: static Object ti_fromitems(const char* cls, CVarRef iterable);
public: static Object t_fromitems(CVarRef iterable) {
return ti_fromitems("stablemap", iterable);
}
public: static Object ti_fromarray(const char* cls, CVarRef arr);
public: static Object t_fromarray(CVarRef arr) {
return ti_fromarray("map", arr);
return ti_fromarray("stablemap", arr);
}
public: static Object ti_fromiterable(const char* cls, CVarRef vec);
public: static Object t_fromiterable(CVarRef vec) {
return ti_fromiterable("map", vec);
return ti_fromiterable("stablemap", vec);
}
public: static void throwOOB(int64_t key) ATTRIBUTE_COLD;
@@ -758,6 +776,8 @@ class c_Tuple : public ExtObjectDataFlags<ObjectData::TupleAttrInit|
public: void t___construct();
public: bool t_isempty();
public: int64_t t_count();
public: Object t_items();
public: Object t_keys();
public: Variant t_at(CVarRef key);
public: Variant t_get(CVarRef key);
public: Array t_toarray();
+26 -4
Ver Arquivo
@@ -2277,6 +2277,8 @@ VM::Instance* new_Vector_Instance(VM::Class*);
TypedValue* tg_6Vector___construct(VM::ActRec *ar);
TypedValue* tg_6Vector_isEmpty(VM::ActRec *ar);
TypedValue* tg_6Vector_count(VM::ActRec *ar);
TypedValue* tg_6Vector_items(VM::ActRec *ar);
TypedValue* tg_6Vector_keys(VM::ActRec *ar);
TypedValue* tg_6Vector_at(VM::ActRec *ar);
TypedValue* tg_6Vector_get(VM::ActRec *ar);
TypedValue* tg_6Vector_set(VM::ActRec *ar);
@@ -2300,6 +2302,7 @@ TypedValue* tg_6Vector___get(VM::ActRec *ar);
TypedValue* tg_6Vector___set(VM::ActRec *ar);
TypedValue* tg_6Vector___isset(VM::ActRec *ar);
TypedValue* tg_6Vector___unset(VM::ActRec *ar);
TypedValue* tg_6Vector_fromItems(VM::ActRec *ar);
TypedValue* tg_6Vector_fromArray(VM::ActRec *ar);
TypedValue* tg_6Vector_fromVector(VM::ActRec *ar);
TypedValue* tg_6Vector_slice(VM::ActRec *ar);
@@ -2314,6 +2317,8 @@ VM::Instance* new_Map_Instance(VM::Class*);
TypedValue* tg_3Map___construct(VM::ActRec *ar);
TypedValue* tg_3Map_isEmpty(VM::ActRec *ar);
TypedValue* tg_3Map_count(VM::ActRec *ar);
TypedValue* tg_3Map_items(VM::ActRec *ar);
TypedValue* tg_3Map_keys(VM::ActRec *ar);
TypedValue* tg_3Map_at(VM::ActRec *ar);
TypedValue* tg_3Map_get(VM::ActRec *ar);
TypedValue* tg_3Map_set(VM::ActRec *ar);
@@ -2337,6 +2342,7 @@ TypedValue* tg_3Map___get(VM::ActRec *ar);
TypedValue* tg_3Map___set(VM::ActRec *ar);
TypedValue* tg_3Map___isset(VM::ActRec *ar);
TypedValue* tg_3Map___unset(VM::ActRec *ar);
TypedValue* tg_3Map_fromItems(VM::ActRec *ar);
TypedValue* tg_3Map_fromArray(VM::ActRec *ar);
TypedValue* tg_3Map_fromIterable(VM::ActRec *ar);
VM::Instance* new_MapIterator_Instance(VM::Class*);
@@ -2350,6 +2356,8 @@ VM::Instance* new_StableMap_Instance(VM::Class*);
TypedValue* tg_9StableMap___construct(VM::ActRec *ar);
TypedValue* tg_9StableMap_isEmpty(VM::ActRec *ar);
TypedValue* tg_9StableMap_count(VM::ActRec *ar);
TypedValue* tg_9StableMap_items(VM::ActRec *ar);
TypedValue* tg_9StableMap_keys(VM::ActRec *ar);
TypedValue* tg_9StableMap_at(VM::ActRec *ar);
TypedValue* tg_9StableMap_get(VM::ActRec *ar);
TypedValue* tg_9StableMap_set(VM::ActRec *ar);
@@ -2372,6 +2380,7 @@ TypedValue* tg_9StableMap___get(VM::ActRec *ar);
TypedValue* tg_9StableMap___set(VM::ActRec *ar);
TypedValue* tg_9StableMap___isset(VM::ActRec *ar);
TypedValue* tg_9StableMap___unset(VM::ActRec *ar);
TypedValue* tg_9StableMap_fromItems(VM::ActRec *ar);
TypedValue* tg_9StableMap___toString(VM::ActRec *ar);
TypedValue* tg_9StableMap_fromArray(VM::ActRec *ar);
TypedValue* tg_9StableMap_fromIterable(VM::ActRec *ar);
@@ -2386,6 +2395,8 @@ VM::Instance* new_Tuple_Instance(VM::Class*);
TypedValue* tg_5Tuple___construct(VM::ActRec *ar);
TypedValue* tg_5Tuple_isEmpty(VM::ActRec *ar);
TypedValue* tg_5Tuple_count(VM::ActRec *ar);
TypedValue* tg_5Tuple_items(VM::ActRec *ar);
TypedValue* tg_5Tuple_keys(VM::ActRec *ar);
TypedValue* tg_5Tuple_toArray(VM::ActRec *ar);
TypedValue* tg_5Tuple_getIterator(VM::ActRec *ar);
TypedValue* tg_5Tuple_at(VM::ActRec *ar);
@@ -5313,11 +5324,13 @@ static const HhbcExtMethodInfo hhbc_ext_methods_DummyClosure[] = {
{ "__construct", tg_12DummyClosure___construct }
};
static const long long hhbc_ext_method_count_Vector = 29;
static const long long hhbc_ext_method_count_Vector = 32;
static const HhbcExtMethodInfo hhbc_ext_methods_Vector[] = {
{ "__construct", tg_6Vector___construct },
{ "isEmpty", tg_6Vector_isEmpty },
{ "count", tg_6Vector_count },
{ "items", tg_6Vector_items },
{ "keys", tg_6Vector_keys },
{ "at", tg_6Vector_at },
{ "get", tg_6Vector_get },
{ "set", tg_6Vector_set },
@@ -5341,6 +5354,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_Vector[] = {
{ "__set", tg_6Vector___set },
{ "__isset", tg_6Vector___isset },
{ "__unset", tg_6Vector___unset },
{ "fromItems", tg_6Vector_fromItems },
{ "fromArray", tg_6Vector_fromArray },
{ "fromVector", tg_6Vector_fromVector },
{ "slice", tg_6Vector_slice }
@@ -5356,11 +5370,13 @@ static const HhbcExtMethodInfo hhbc_ext_methods_VectorIterator[] = {
{ "rewind", tg_14VectorIterator_rewind }
};
static const long long hhbc_ext_method_count_Map = 28;
static const long long hhbc_ext_method_count_Map = 31;
static const HhbcExtMethodInfo hhbc_ext_methods_Map[] = {
{ "__construct", tg_3Map___construct },
{ "isEmpty", tg_3Map_isEmpty },
{ "count", tg_3Map_count },
{ "items", tg_3Map_items },
{ "keys", tg_3Map_keys },
{ "at", tg_3Map_at },
{ "get", tg_3Map_get },
{ "set", tg_3Map_set },
@@ -5384,6 +5400,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_Map[] = {
{ "__set", tg_3Map___set },
{ "__isset", tg_3Map___isset },
{ "__unset", tg_3Map___unset },
{ "fromItems", tg_3Map_fromItems },
{ "fromArray", tg_3Map_fromArray },
{ "fromIterable", tg_3Map_fromIterable }
};
@@ -5398,11 +5415,13 @@ static const HhbcExtMethodInfo hhbc_ext_methods_MapIterator[] = {
{ "rewind", tg_11MapIterator_rewind }
};
static const long long hhbc_ext_method_count_StableMap = 28;
static const long long hhbc_ext_method_count_StableMap = 31;
static const HhbcExtMethodInfo hhbc_ext_methods_StableMap[] = {
{ "__construct", tg_9StableMap___construct },
{ "isEmpty", tg_9StableMap_isEmpty },
{ "count", tg_9StableMap_count },
{ "items", tg_9StableMap_items },
{ "keys", tg_9StableMap_keys },
{ "at", tg_9StableMap_at },
{ "get", tg_9StableMap_get },
{ "set", tg_9StableMap_set },
@@ -5425,6 +5444,7 @@ static const HhbcExtMethodInfo hhbc_ext_methods_StableMap[] = {
{ "__set", tg_9StableMap___set },
{ "__isset", tg_9StableMap___isset },
{ "__unset", tg_9StableMap___unset },
{ "fromItems", tg_9StableMap_fromItems },
{ "__toString", tg_9StableMap___toString },
{ "fromArray", tg_9StableMap_fromArray },
{ "fromIterable", tg_9StableMap_fromIterable }
@@ -5440,11 +5460,13 @@ static const HhbcExtMethodInfo hhbc_ext_methods_StableMapIterator[] = {
{ "rewind", tg_17StableMapIterator_rewind }
};
static const long long hhbc_ext_method_count_Tuple = 7;
static const long long hhbc_ext_method_count_Tuple = 9;
static const HhbcExtMethodInfo hhbc_ext_methods_Tuple[] = {
{ "__construct", tg_5Tuple___construct },
{ "isEmpty", tg_5Tuple_isEmpty },
{ "count", tg_5Tuple_count },
{ "items", tg_5Tuple_items },
{ "keys", tg_5Tuple_keys },
{ "toArray", tg_5Tuple_toArray },
{ "getIterator", tg_5Tuple_getIterator },
{ "at", tg_5Tuple_at },
+82 -24
Ver Arquivo
@@ -22383,7 +22383,7 @@ const char *g_class_map[] = {
"/**\n * ( excerpt from http://php.net/manual/en/class.vector.php )\n *\n * An ordered collection where values are keyed using integers 0 thru n-1\n * in order.\n *\n */",
"keyediterable", "countable", NULL,
(const char *)0x10006040, "__construct", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.construct.php )\n *\n *\n * @iterable mixed\n */",
"/**\n * ( excerpt from http://php.net/manual/en/vector.construct.php )\n *\n * Returns a Vector built from the values produced by the specified\n * Iterable.\n *\n * @iterable mixed\n */",
(const char *)-1, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "N;", "null", NULL,
NULL,
NULL,
@@ -22398,6 +22398,16 @@ const char *g_class_map[] = {
(const char *)0xa, NULL,
NULL,
NULL,
(const char *)0x10006040, "items", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.items.php )\n *\n * Returns an Iterable that produces the values from this Vector.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "keys", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.keys.php )\n *\n * Returns an Iterable that produces the keys from this Vector.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "at", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.at.php )\n *\n * Returns the value at the specified key. If the key is not present, an\n * exception is thrown.\n *\n * @key mixed\n *\n * @return mixed\n */",
(const char *)0xffffffff, (const char *)0x2000, "key", "", (const char *)0xffffffff, "", "", NULL,
@@ -22466,7 +22476,7 @@ const char *g_class_map[] = {
NULL,
NULL,
(const char *)0x10006040, "toArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.toarray.php )\n *\n * Returns an array containing the values from this Vector.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/vector.toarray.php )\n *\n * Returns an array built from the values from this Vector.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
@@ -22535,8 +22545,14 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006240, "fromItems", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.fromitems.php )\n *\n * Returns a Vector built from the values produced by the specified\n * Iterable.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006240, "fromArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.fromarray.php )\n *\n * Returns a Vector containing the values from the specified array.\n *\n * @arr mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/vector.fromarray.php )\n *\n * Returns a Vector built from the values from the specified array.\n *\n * @arr mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "arr", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
@@ -22548,7 +22564,7 @@ const char *g_class_map[] = {
NULL,
NULL,
(const char *)0x10006240, "slice", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/vector.slice.php )\n *\n * Returns a Vector containing the specified slice of values from the\n * specified Vector.\n *\n * @vec mixed\n * @offset mixed\n * @len mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/vector.slice.php )\n *\n * Returns a Vector built from the specified slice of values from the\n * specified Vector.\n *\n * @vec mixed\n * @offset mixed\n * @len mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "vec", "", (const char *)0xffffffff, "", "", NULL,
(const char *)0x2000, "offset", "", (const char *)0xffffffff, "", "", NULL,
(const char *)0x2000, "len", "", (const char *)0xffffffff, "N;", "null", NULL,
@@ -22600,7 +22616,7 @@ const char *g_class_map[] = {
"/**\n * ( excerpt from http://php.net/manual/en/class.map.php )\n *\n * An unordered dictionary-style collection.\n *\n */",
"keyediterable", "countable", NULL,
(const char *)0x10006040, "__construct", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.construct.php )\n *\n *\n * @iterable mixed\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.construct.php )\n *\n * Returns a Map built from the keys and values produced by the specified\n * KeyedIterable.\n *\n * @iterable mixed\n */",
(const char *)-1, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "N;", "null", NULL,
NULL,
NULL,
@@ -22615,6 +22631,16 @@ const char *g_class_map[] = {
(const char *)0xa, NULL,
NULL,
NULL,
(const char *)0x10006040, "items", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.items.php )\n *\n * Returns an Iterable that produces the key/value pairs as Tuples from\n * this Map.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "keys", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.keys.php )\n *\n * Returns an Iterable that produces the keys from this Map.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "at", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.at.php )\n *\n * Returns the value at the specified key. If the key is not present, an\n * exception is thrown.\n *\n * @key mixed\n *\n * @return mixed\n */",
(const char *)0xffffffff, (const char *)0x2000, "key", "", (const char *)0xffffffff, "", "", NULL,
@@ -22671,38 +22697,38 @@ const char *g_class_map[] = {
NULL,
NULL,
(const char *)0x10006040, "toArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.toarray.php )\n *\n * Returns an array containing the key/value pairs from this Map.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.toarray.php )\n *\n * Returns an array built from the keys and values from this Map.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
(const char *)0x10006040, "copyAsArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.copyasarray.php )\n *\n * Returns an array containing the key/value pairs from this Map.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.copyasarray.php )\n *\n * Returns an array built from the keys and values from this Map.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
(const char *)0x10006040, "toKeysArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.tokeysarray.php )\n *\n * Returns an array containing the keys from this Map.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.tokeysarray.php )\n *\n * Returns an array built from the keys from this Map.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
(const char *)0x10006040, "values", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.values.php )\n *\n * Returns a Vector containing the values from this Map.\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.values.php )\n *\n * Returns a Vector built from the values from this Map.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "toValuesArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.tovaluesarray.php )\n *\n * Returns an array containing the values from this Map.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.tovaluesarray.php )\n *\n * Returns an array built from the values from this Map.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
(const char *)0x10006040, "updateFromArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.updatefromarray.php )\n *\n * Inserts the key/value pairs from the specified array into this Map.\n *\n * @arr mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.updatefromarray.php )\n *\n * Inserts the keys and values from the specified array into this Map.\n *\n * @arr mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "arr", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "updateFromIterable", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.updatefromiterable.php )\n *\n * Inserts the key/value pairs produced by the specified Iterable.\n *\n * @it mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.updatefromiterable.php )\n *\n * Inserts the keys and values produced by the specified KeyedIterable.\n *\n * @it mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "it", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
@@ -22748,14 +22774,20 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006240, "fromItems", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.fromitems.php )\n *\n * Returns a Map built from the key/value Tuples produced by the specified\n * Iterable.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006240, "fromArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.fromarray.php )\n *\n * Returns a Map containing the key/value pairs from the specified array.\n *\n * @mp mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.fromarray.php )\n *\n * Returns a Map built from the keys and values from the specified array.\n *\n * @mp mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "mp", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006240, "fromIterable", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/map.fromiterable.php )\n *\n * Returns a Map containing the key/value pairs produced by the specified\n * Iterable.\n *\n * @mp mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/map.fromiterable.php )\n *\n * Returns a Map built from the keys and values produced by the specified\n * KeyedIterable.\n *\n * @mp mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "mp", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
@@ -22805,7 +22837,7 @@ const char *g_class_map[] = {
"/**\n * ( excerpt from http://php.net/manual/en/class.stablemap.php )\n *\n * An ordered dictionary-style collection.\n *\n */",
"keyediterable", "countable", NULL,
(const char *)0x10006040, "__construct", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.construct.php )\n *\n *\n * @iterable mixed\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.construct.php )\n *\n * Returns a StableMap built from the keys and values produced by the\n * specified KeyedIterable.\n *\n * @iterable mixed\n */",
(const char *)-1, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "N;", "null", NULL,
NULL,
NULL,
@@ -22820,6 +22852,16 @@ const char *g_class_map[] = {
(const char *)0xa, NULL,
NULL,
NULL,
(const char *)0x10006040, "items", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.items.php )\n *\n * Returns an Iterable that produces the key/value pairs as Tuples from\n * this StableMap.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "keys", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.keys.php )\n *\n * Returns an Iterable that produces the keys from this StableMap.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "at", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.at.php )\n *\n * Returns the value at the specified key. If the key is not present, an\n * exception is thrown.\n *\n * @key mixed\n *\n * @return mixed\n */",
(const char *)0xffffffff, (const char *)0x2000, "key", "", (const char *)0xffffffff, "", "", NULL,
@@ -22876,27 +22918,27 @@ const char *g_class_map[] = {
NULL,
NULL,
(const char *)0x10006040, "toArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.toarray.php )\n *\n * Returns an array containing the key/value pairs from this StableMap.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.toarray.php )\n *\n * Returns an array built from the keys and values from this StableMap.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
(const char *)0x10006040, "copyAsArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.copyasarray.php )\n *\n * Returns an array containing the key/value pairs from this StableMap.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.copyasarray.php )\n *\n * Returns an array built from the keys and values from this StableMap.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
(const char *)0x10006040, "toKeysArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.tokeysarray.php )\n *\n * Returns an array containing the keys from this StableMap.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.tokeysarray.php )\n *\n * Returns an array built from the keys from this StableMap.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
(const char *)0x10006040, "values", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.values.php )\n *\n * Returns a Vector containing the values from this StableMap.\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.values.php )\n *\n * Returns a Vector built from the values from this StableMap.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "toValuesArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.tovaluesarray.php )\n *\n * Returns an array containing the values from this StableMap.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.tovaluesarray.php )\n *\n * Returns an array built from the values from this StableMap.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
@@ -22907,7 +22949,7 @@ const char *g_class_map[] = {
NULL,
NULL,
(const char *)0x10006040, "updateFromIterable", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.updatefromiterable.php\n * )\n *\n * Inserts the key/value pairs produced by the specified Iterable.\n *\n * @it mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.updatefromiterable.php\n * )\n *\n * Inserts the keys and values produced by the specified KeyedIterable.\n *\n * @it mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "it", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
@@ -22948,19 +22990,25 @@ const char *g_class_map[] = {
NULL,
NULL,
NULL,
(const char *)0x10006240, "fromItems", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.fromitems.php )\n *\n * Returns a StableMap built from the key/value Tuples produced by the\n * specified Iterable.\n *\n * @iterable mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "iterable", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006040, "__toString", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.tostring.php )\n *\n *\n * @return string\n */",
(const char *)0x14, NULL,
NULL,
NULL,
(const char *)0x10006240, "fromArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.fromarray.php )\n *\n * Returns a StableMap containing the key/value pairs from the specified\n * array.\n *\n * @mp mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.fromarray.php )\n *\n * Returns a StableMap built from the keys and values from the specified\n * array.\n *\n * @mp mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "mp", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
NULL,
(const char *)0x10006240, "fromIterable", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.fromiterable.php )\n *\n * Returns a StableMap containing the key/value pairs produced by the\n * specified Iterable.\n *\n * @mp mixed\n *\n * @return object\n */",
"/**\n * ( excerpt from http://php.net/manual/en/stablemap.fromiterable.php )\n *\n * Returns a StableMap built from the keys and values produced by the\n * specified KeyedIterable.\n *\n * @mp mixed\n *\n * @return object\n */",
(const char *)0x40, (const char *)0x2000, "mp", "", (const char *)0xffffffff, "", "", NULL,
NULL,
NULL,
@@ -23024,8 +23072,18 @@ const char *g_class_map[] = {
(const char *)0xa, NULL,
NULL,
NULL,
(const char *)0x10006040, "items", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/tuple.items.php )\n *\n * Returns an Iterable that produces the values from this Tuple.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "keys", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/tuple.keys.php )\n *\n * Returns an Iterable that produces the keys from this Tuple.\n *\n * @return object\n */",
(const char *)0x40, NULL,
NULL,
NULL,
(const char *)0x10006040, "toArray", "", (const char*)0, (const char*)0,
"/**\n * ( excerpt from http://php.net/manual/en/tuple.toarray.php )\n *\n * Returns an array containing the values from this Tuple.\n *\n * @return map\n */",
"/**\n * ( excerpt from http://php.net/manual/en/tuple.toarray.php )\n *\n * Returns an array built from the values from this Tuple.\n *\n * @return map\n */",
(const char *)0x20, NULL,
NULL,
NULL,
+68
Ver Arquivo
@@ -0,0 +1,68 @@
<?php
class KeysIterator implements Iterator {
public $it;
public function __construct($it) {
$this->it = $it;
}
public function rewind() {
$this->it->rewind();
}
public function valid() {
return $this->it->valid();
}
public function next() {
$this->it->next();
}
public function key() {
throw new RuntimeException(
"Call to undefined method KeysIterator::keys()");
}
public function current() {
return $this->it->key();
}
}
class KeysIterable implements Iterable {
public $it;
public function __construct($iterable) {
$this->it = new KeysIterator($iterable->getIterator());
}
public function getIterator() {
return clone $this->it;
}
}
class MapItemsIterator implements Iterator {
public $it;
public function __construct($it) {
$this->it = $it;
}
public function rewind() {
$this->it->rewind();
}
public function valid() {
return $this->it->valid();
}
public function next() {
$this->it->next();
}
public function key() {
throw new RuntimeException(
"Call to undefined method MapItemsIterator::keys()");
}
public function current() {
return Tuple {$this->it->key(), $this->it->current()};
}
}
class MapItemsIterable implements Iterable {
public $it;
public function __construct($iterable) {
$this->it = new MapItemsIterator($iterable->getIterator());
}
public function getIterator() {
return clone $this->it;
}
}
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+8
Ver Arquivo
@@ -119,6 +119,14 @@ ObjectData* SystemLib::AllocSplFileInfoObject(CVarRef filename) {
CREATE_AND_CONSTRUCT(SplFileInfo, CREATE_VECTOR1(filename));
}
ObjectData* SystemLib::AllocKeysIterableObject(CVarRef mp) {
CREATE_AND_CONSTRUCT(KeysIterable, CREATE_VECTOR1(mp));
}
ObjectData* SystemLib::AllocMapItemsIterableObject(CVarRef mp) {
CREATE_AND_CONSTRUCT(MapItemsIterable, CREATE_VECTOR1(mp));
}
#undef CREATE_AND_CONSTRUCT
VM::Func*
+4
Ver Arquivo
@@ -59,6 +59,8 @@ namespace Eval {
x(JsonSerializable) \
x(Traversable) \
x(Countable) \
x(KeysIterable) \
x(MapItemsIterable) \
x(__PHP_Incomplete_Class) \
class SystemLib {
@@ -102,6 +104,8 @@ class SystemLib {
CVarRef detail = null_variant,
CVarRef name = null_variant,
CVarRef header = null_variant);
static ObjectData* AllocKeysIterableObject(CVarRef mp);
static ObjectData* AllocMapItemsIterableObject(CVarRef mp);
};
///////////////////////////////////////////////////////////////////////////////
+122
Ver Arquivo
@@ -9921,6 +9921,128 @@ bool TestCodeRun::TestCollectionClasses() {
);
}
MVCRO("<?php\n"
"$v = Vector {11, 42, 73};\n"
"foreach ($v->keys() as $x) {\n"
" var_dump($x);\n"
"}\n"
"$mp = StableMap {'a' => 1, 2 => 'b', 'z' => 9};\n"
"foreach ($mp->keys() as $x) {\n"
" var_dump($x);\n"
"}\n"
"var_dump(new Vector($mp->keys()));\n"
,
"int(0)\n"
"int(1)\n"
"int(2)\n"
"string(1) \"a\"\n"
"int(2)\n"
"string(1) \"z\"\n"
"object(Vector)#7 (3) {\n"
" [0]=>\n"
" string(1) \"a\"\n"
" [1]=>\n"
" int(2)\n"
" [2]=>\n"
" string(1) \"z\"\n"
"}\n"
);
MVCRO("<?php\n"
"$vec1 = Vector {11, 42, 73};\n"
"foreach ($vec1->items() as $x) {\n"
" var_dump($x);\n"
"}\n"
"$mp1 = StableMap {'a' => 1, 2 => 'b', 'z' => 9};\n"
"foreach ($mp1->items() as $t) {\n"
" var_dump($t[0], $t[1]);\n"
"}\n"
"var_dump(new Vector($mp1->items()));\n"
"echo \"==========\\n\";\n"
"$vec2 = Vector::fromItems($mp1->items());\n"
"var_dump($vec2);\n"
"$mp2 = StableMap::fromItems($mp1->items());\n"
"var_dump($mp2);\n"
"echo \"==========\\n\";\n"
"$tuples = Vector {Tuple {'a', 1}, Tuple {2, 'b'}, Tuple {'z', 9}};\n"
"$mp3 = StableMap::fromItems($tuples);\n"
"var_dump($mp3);\n"
,
"int(11)\n"
"int(42)\n"
"int(73)\n"
"string(1) \"a\"\n"
"int(1)\n"
"int(2)\n"
"string(1) \"b\"\n"
"string(1) \"z\"\n"
"int(9)\n"
"object(Vector)#10 (3) {\n"
" [0]=>\n"
" object(Tuple)#15 (2) {\n"
" [0]=>\n"
" string(1) \"a\"\n"
" [1]=>\n"
" int(1)\n"
" }\n"
" [1]=>\n"
" object(Tuple)#16 (2) {\n"
" [0]=>\n"
" int(2)\n"
" [1]=>\n"
" string(1) \"b\"\n"
" }\n"
" [2]=>\n"
" object(Tuple)#17 (2) {\n"
" [0]=>\n"
" string(1) \"z\"\n"
" [1]=>\n"
" int(9)\n"
" }\n"
"}\n"
"==========\n"
"object(Vector)#21 (3) {\n"
" [0]=>\n"
" object(Tuple)#22 (2) {\n"
" [0]=>\n"
" string(1) \"a\"\n"
" [1]=>\n"
" int(1)\n"
" }\n"
" [1]=>\n"
" object(Tuple)#23 (2) {\n"
" [0]=>\n"
" int(2)\n"
" [1]=>\n"
" string(1) \"b\"\n"
" }\n"
" [2]=>\n"
" object(Tuple)#24 (2) {\n"
" [0]=>\n"
" string(1) \"z\"\n"
" [1]=>\n"
" int(9)\n"
" }\n"
"}\n"
"object(StableMap)#29 (3) {\n"
" [\"a\"]=>\n"
" int(1)\n"
" [2]=>\n"
" string(1) \"b\"\n"
" [\"z\"]=>\n"
" int(9)\n"
"}\n"
"==========\n"
"object(StableMap)#34 (3) {\n"
" [\"a\"]=>\n"
" int(1)\n"
" [2]=>\n"
" string(1) \"b\"\n"
" [\"z\"]=>\n"
" int(9)\n"
"}\n"
);
return true;
}