Implement spread operator (#168)

Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik 2019-04-12 02:24:56 +02:00 committed by yichoi
commit ae28733902
16 changed files with 396 additions and 23 deletions

View file

@ -28,14 +28,14 @@ namespace Escargot {
size_t g_arrayObjectTag;
ArrayObject::ArrayObject(ExecutionState& state)
ArrayObject::ArrayObject(ExecutionState& state, bool hasSpreadElement)
: Object(state, ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER + 1, true)
{
m_structure = state.context()->defaultStructureForArrayObject();
m_values[ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER] = Value(0);
Object::setPrototype(state, state.context()->globalObject()->arrayPrototype());
if (UNLIKELY(state.context()->vmInstance()->didSomePrototypeObjectDefineIndexedProperty())) {
if (UNLIKELY(state.context()->vmInstance()->didSomePrototypeObjectDefineIndexedProperty() || hasSpreadElement)) {
ensureObjectRareData()->m_isFastModeArrayObject = false;
}
}