implement basic of JSGetterSetter

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2016-12-21 12:39:18 +09:00
commit 24ff648fe7
14 changed files with 364 additions and 153 deletions

View file

@ -86,7 +86,7 @@ static Value builtinArrayJoin(ExecutionState& state, Value thisValue, size_t arg
builder.appendString(sep);
}
}
Value elem = thisBinded->get(state, ObjectPropertyName(state, Value(curIndex))).value();
Value elem = thisBinded->get(state, ObjectPropertyName(state, Value(curIndex))).value(state);
if (!elem.isUndefinedOrNull()) {
builder.appendString(elem.toString(state));
@ -167,7 +167,7 @@ static Value builtinArraySplice(ExecutionState& state, Value thisValue, size_t a
ObjectGetResult fromValue = thisObject->get(state, ObjectPropertyName(state, Value(actualStart + k)));
if (fromValue.hasValue()) {
array->defineOwnProperty(state, ObjectPropertyName(state, Value(k)),
ObjectPropertyDescriptor(fromValue.value(), ObjectPropertyDescriptor::AllPresent));
ObjectPropertyDescriptor(fromValue.value(state), ObjectPropertyDescriptor::AllPresent));
k++;
} else {
k = Object::nextIndexForward(state, thisObject, k, len, false);
@ -183,7 +183,7 @@ static Value builtinArraySplice(ExecutionState& state, Value thisValue, size_t a
uint32_t to = k + insertCnt;
ObjectGetResult fromValue = thisObject->get(state, ObjectPropertyName(state, Value(from)));
if (fromValue.hasValue()) {
thisObject->setThrowsException(state, ObjectPropertyName(state, Value(to)), fromValue.value(), thisObject);
thisObject->setThrowsException(state, ObjectPropertyName(state, Value(to)), fromValue.value(state), thisObject);
} else {
thisObject->deleteOwnProperty(state, ObjectPropertyName(state, Value(to)));
}
@ -214,7 +214,7 @@ static Value builtinArraySplice(ExecutionState& state, Value thisValue, size_t a
static Value builtinArrayToString(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
{
RESOLVE_THIS_BINDING_TO_OBJECT(thisObject, Array, toString);
Value toString = thisObject->get(state, state.context()->staticStrings().join).value();
Value toString = thisObject->get(state, state.context()->staticStrings().join).value(state);
if (!toString.isFunction()) {
toString = state.context()->globalObject()->objectPrototypeToString();
}
@ -239,7 +239,7 @@ static Value builtinArrayConcat(ExecutionState& state, Value thisValue, size_t a
while (curIndex < len) {
ObjectGetResult exists = arr->get(state, ObjectPropertyName(state, Value(curIndex)));
if (exists.hasValue()) {
array->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(n + curIndex)), ObjectPropertyDescriptor(exists.value(), ObjectPropertyDescriptor::AllPresent));
array->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(n + curIndex)), ObjectPropertyDescriptor(exists.value(state), ObjectPropertyDescriptor::AllPresent));
curIndex++;
} else {
curIndex = Object::nextIndexForward(state, arr, curIndex, len, false);
@ -272,7 +272,7 @@ static Value builtinArraySlice(ExecutionState& state, Value thisValue, size_t ar
ObjectGetResult exists = thisObject->get(state, ObjectPropertyName(state, Value(k)));
if (exists.hasValue()) {
array->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(n)),
ObjectPropertyDescriptor(exists.value(), ObjectPropertyDescriptor::AllPresent));
ObjectPropertyDescriptor(exists.value(state), ObjectPropertyDescriptor::AllPresent));
k++;
n++;
} else {
@ -302,7 +302,7 @@ static Value builtinArrayForEach(ExecutionState& state, Value thisValue, size_t
Value Pk = Value(k);
auto res = thisObject->get(state, ObjectPropertyName(state, Pk));
if (res.hasValue()) {
Value kValue = res.value();
Value kValue = res.value(state);
Value args[3] = { kValue, Pk, thisObject };
callbackfn.asFunction()->call(state, thisArg, 3, args, false);
k++;