ArrayData *VectorArray::addLval(CVarRef k, Variant *&ret, bool copy) {
  ASSERT(!exists(k));
  Variant::TypedValueAccessor tva = k.getTypedAccessor();
  if (isIntKey(tva)) return VectorArray::addLval(getIntKey(tva), ret, copy);
  ASSERT(k.isString());
  ZendArray *a = escalateToZendArray();
  a->addLval(StrNR(getStringKey(tva)), ret, false);
  return a;
}
Beispiel #2
0
ArrayData *VectorArray::addLval(int64 k, Variant *&ret, bool copy) {
  assert(!exists(k));
  if (k != m_size) {
    ZendArray *a = escalateToZendArray();
    a->addLval(k, ret, false);
    return a;
  }
  uint index = m_size;
  if (UNLIKELY(copy)) {
    VectorArray *a = NEW(VectorArray)(this);
    a->VectorArray::addLval(k, ret, false);
    return a;
  }
  checkSize();
  Variant& v = tvAsUninitializedVariant(&m_elems[index]);
  v.setUninitNull();
  ret = &v;
  checkInsertIterator((ssize_t)index);
  m_size++;
  return nullptr;
}
Beispiel #3
0
ArrayData *VectorArray::addLval(StringData* k, Variant *&ret, bool copy) {
  ZendArray *a = escalateToZendArray();
  a->addLval(k, ret, false);
  return a;
}