mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 18:20:04 +00:00
异常未及时返回part3
Signed-off-by: 杨云飞 <yangyunfei19@h-partners.com>
This commit is contained in:
parent
35a2eb3be4
commit
3d46f60485
@ -112,6 +112,7 @@ bool ArrayHelper::ElementIsStrictEqualTo(JSThread *thread, const JSHandle<JSTagg
|
||||
const JSHandle<JSTaggedValue> &target)
|
||||
{
|
||||
bool exists = thisObjVal->IsTypedArray() || JSTaggedValue::HasProperty(thread, thisObjVal, keyHandle);
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
||||
if (thread->HasPendingException() || !exists) {
|
||||
return false;
|
||||
}
|
||||
|
@ -728,6 +728,7 @@ JSTaggedValue BuiltinsArkTools::CreateDataProperty([[maybe_unused]] EcmaRuntimeC
|
||||
JSHandle<JSTaggedValue> value = GetCallArg(info, secondArg);
|
||||
JSHandle<JSObject> obj = JSHandle<JSObject>::Cast(GetCallArg(info, 0));
|
||||
JSObject::CreateDataPropertyOrThrow(thread, obj, key, value);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
return value.GetTaggedValue();
|
||||
}
|
||||
|
||||
|
@ -431,6 +431,7 @@ JSTaggedValue BuiltinsArray::Concat(EcmaRuntimeCallInfo *argv)
|
||||
// 2. Let A be ArraySpeciesCreate(O, 0).
|
||||
uint32_t arrayLen = 0;
|
||||
JSTaggedValue newArray = JSArray::ArraySpeciesCreate(thread, thisObjHandle, JSTaggedNumber(arrayLen));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
if (!(newArray.IsECMAObject() || newArray.IsUndefined())) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, "array must be object or undefined.", JSTaggedValue::Exception());
|
||||
}
|
||||
@ -469,6 +470,7 @@ JSTaggedValue BuiltinsArray::Concat(EcmaRuntimeCallInfo *argv)
|
||||
|
||||
if (ele->IsStableJSArray(thread)) {
|
||||
JSStableArray::Concat(thread, newArrayHandle, JSHandle<JSObject>::Cast(ele), k, n);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
// iv. Repeat, while k < len,
|
||||
while (k < len) {
|
||||
@ -932,6 +934,7 @@ JSTaggedValue BuiltinsArray::Filter(EcmaRuntimeCallInfo *argv)
|
||||
uint32_t k = 0;
|
||||
if (thisObjVal->IsStableJSArray(thread)) {
|
||||
JSStableArray::Filter(newArrayHandle, thisObjHandle, argv, k, toIndex);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
return FilterUnStableJSArray(thread, thisArgHandle, thisObjVal, k, len, toIndex, newArrayHandle, callbackFnHandle);
|
||||
}
|
||||
@ -1481,6 +1484,7 @@ JSTaggedValue BuiltinsArray::Map(EcmaRuntimeCallInfo *argv)
|
||||
uint32_t len = static_cast<uint32_t>(rawLen);
|
||||
if (thisObjVal->IsStableJSArray(thread)) {
|
||||
JSStableArray::Map(newArrayHandle, thisObjHandle, argv, k, len);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
|
||||
JSMutableHandle<JSTaggedValue> mapResultHandle(thread, JSTaggedValue::Undefined());
|
||||
|
@ -106,15 +106,16 @@ JSTaggedValue BuiltinsAsyncFromSyncIterator::Throw(EcmaRuntimeCallInfo *argv)
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, throwResult, syncIterator, undefinedValue, 0);
|
||||
RETURN_REJECT_PROMISE_IF_ABRUPT(thread, throwResult, pcap);
|
||||
ret = JSFunction::Call(callInfo);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
} else {
|
||||
EcmaRuntimeCallInfo *callInfo =
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, throwResult, syncIterator, undefinedValue, 1);
|
||||
RETURN_REJECT_PROMISE_IF_ABRUPT(thread, throwResult, pcap);
|
||||
callInfo->SetCallArg(value.GetTaggedValue());
|
||||
ret = JSFunction::Call(callInfo);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
JSHandle<JSTaggedValue> result(thread, ret);
|
||||
RETURN_REJECT_PROMISE_IF_ABRUPT(thread, result, pcap);
|
||||
// 11.If Type(result) is not Object, then
|
||||
if (!result->IsECMAObject()) {
|
||||
// a.Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
|
||||
@ -125,6 +126,7 @@ JSTaggedValue BuiltinsAsyncFromSyncIterator::Throw(EcmaRuntimeCallInfo *argv)
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, reject, undefinedValue, undefinedValue, 1);
|
||||
info->SetCallArg(resolutionError.GetTaggedValue());
|
||||
JSFunction::Call(info);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
// b.Return promiseCapability.[[Promise]].
|
||||
JSHandle<JSObject> promise(thread, pcap->GetPromise());
|
||||
@ -181,15 +183,16 @@ JSTaggedValue BuiltinsAsyncFromSyncIterator::Return(EcmaRuntimeCallInfo *argv)
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, returnResult, syncIterator, undefinedValue, 0);
|
||||
RETURN_REJECT_PROMISE_IF_ABRUPT(thread, returnResult, pcap);
|
||||
ret = JSFunction::Call(callInfo);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
} else {
|
||||
EcmaRuntimeCallInfo *callInfo =
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, returnResult, syncIterator, undefinedValue, 1);
|
||||
RETURN_REJECT_PROMISE_IF_ABRUPT(thread, returnResult, pcap);
|
||||
callInfo->SetCallArg(value.GetTaggedValue());
|
||||
ret = JSFunction::Call(callInfo);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
JSHandle<JSTaggedValue> result(thread, ret);
|
||||
RETURN_REJECT_PROMISE_IF_ABRUPT(thread, result, pcap);
|
||||
// 11.If Type(result) is not Object, then
|
||||
if (!result->IsECMAObject()) {
|
||||
// a.Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
|
||||
@ -201,6 +204,7 @@ JSTaggedValue BuiltinsAsyncFromSyncIterator::Return(EcmaRuntimeCallInfo *argv)
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, reject, undefinedValue, undefinedValue, 1);
|
||||
info->SetCallArg(rstErr.GetTaggedValue());
|
||||
JSFunction::Call(info);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
// b.Return promiseCapability.[[Promise]].
|
||||
JSHandle<JSObject> promise(thread, pcap->GetPromise());
|
||||
|
@ -40,6 +40,7 @@ JSTaggedValue BuiltinsBigInt::BigIntConstructor(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
|
||||
// 2. Let prim be ? ToPrimitive(value).
|
||||
JSHandle<JSTaggedValue> Primitive(thread, JSTaggedValue::ToPrimitive(thread, value));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
// 3. If Type(prim) is Number, return ? NumberToBigInt(prim).
|
||||
if (Primitive->IsNumber()) {
|
||||
return BigInt::NumberToBigInt(thread, Primitive);
|
||||
|
@ -160,7 +160,7 @@ JSTaggedValue BuiltinsDate::ToJSON(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> objectHandle = JSHandle<JSTaggedValue>::Cast(object);
|
||||
JSHandle<JSTaggedValue> tv(thread,
|
||||
JSTaggedValue::ToPrimitive(thread, objectHandle, PreferredPrimitiveType::PREFER_NUMBER));
|
||||
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
// 3. If Type(tv) is Number and tv is not finite, return null
|
||||
if (tv->IsNumber()) {
|
||||
if (tv->IsDouble() && !std::isfinite(tv->GetDouble())) {
|
||||
|
@ -457,7 +457,9 @@ JSTaggedValue BuiltinsRegExp::GetSource(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> constructor = GetConstructor(argv);
|
||||
if (objConstructor->IsJSFunction() && constructor->IsJSFunction()) {
|
||||
JSHandle<GlobalEnv> objRealm = JSObject::GetFunctionRealm(thread, objConstructor);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<GlobalEnv> ctorRealm = JSObject::GetFunctionRealm(thread, constructor);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
if (objRealm->GetRegExpPrototype() == thisObj && *objRealm == *ctorRealm) {
|
||||
JSHandle<EcmaString> result = thread->GetEcmaVM()->GetFactory()->NewFromASCII("(?:)");
|
||||
return result.GetTaggedValue();
|
||||
@ -1079,6 +1081,7 @@ JSTaggedValue BuiltinsRegExp::ReplaceInternal(JSThread *thread,
|
||||
ncaptures = std::max<uint32_t>((ncaptures - 1), 0);
|
||||
// d. Let matched be ToString(Get(result, "0")).
|
||||
JSTaggedValue value = ObjectFastOperator::GetPropertyByIndex(thread, resultValues.GetTaggedValue(), 0);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
getMatchString.Update(value);
|
||||
JSHandle<EcmaString> matchString = JSTaggedValue::ToString(thread, getMatchString);
|
||||
// e. ReturnIfAbrupt(matched).
|
||||
@ -1328,6 +1331,7 @@ JSTaggedValue BuiltinsRegExp::Split(EcmaRuntimeCallInfo *argv)
|
||||
const GlobalEnvConstants *globalConstants = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> flagsString(globalConstants->GetHandledFlagsString());
|
||||
JSHandle<JSTaggedValue> taggedFlags = JSObject::GetProperty(thread, thisObj, flagsString).GetValue();
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<EcmaString> flags;
|
||||
|
||||
if (taggedFlags->IsUndefined()) {
|
||||
@ -1447,6 +1451,7 @@ JSTaggedValue BuiltinsRegExp::Split(EcmaRuntimeCallInfo *argv)
|
||||
// i. Let e be ToLength(Get(splitter, "lastIndex")).
|
||||
JSHandle<JSTaggedValue> lastIndexHandle =
|
||||
JSObject::GetProperty(thread, splitter, lastIndexString).GetValue();
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSTaggedNumber lastIndexNumber = JSTaggedValue::ToLength(thread, lastIndexHandle);
|
||||
// ii. ReturnIfAbrupt(e).
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1482,6 +1487,7 @@ JSTaggedValue BuiltinsRegExp::Split(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> lengthString(thread->GlobalConstants()->GetHandledLengthString());
|
||||
JSHandle<JSTaggedValue> capturesHandle =
|
||||
JSObject::GetProperty(thread, execResult, lengthString).GetValue();
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSTaggedNumber numberOfCapturesNumber = JSTaggedValue::ToLength(thread, capturesHandle);
|
||||
// 8. ReturnIfAbrupt(numberOfCaptures).
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -1757,6 +1763,7 @@ JSTaggedValue BuiltinsRegExp::GetFlagsInternal(JSThread *thread, const JSHandle<
|
||||
if (objConstructor->IsJSFunction() && constructor->IsJSFunction()) {
|
||||
JSHandle<GlobalEnv> objRealm = JSObject::GetFunctionRealm(thread, objConstructor);
|
||||
JSHandle<GlobalEnv> ctorRealm = JSObject::GetFunctionRealm(thread, constructor);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
if (objRealm->GetRegExpPrototype() == obj && *objRealm == *ctorRealm) {
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
@ -289,6 +289,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeArrayList(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(prototype), constructorKey, arrayListFunction);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
|
||||
// ArrayList.prototype
|
||||
SetFrozenFunction(thread, prototype, "add", ContainersArrayList::Add, FuncLength::ONE);
|
||||
@ -363,6 +364,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeLightWeightMap(JSThread *th
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(funcPrototype), constructorKey, lightWeightMapFunction);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
|
||||
// LightWeightMap.prototype.add()
|
||||
SetFrozenFunction(thread, funcPrototype, "hasAll", ContainersLightWeightMap::HasAll, FuncLength::ONE);
|
||||
@ -436,6 +438,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeLightWeightSet(JSThread *th
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(funcPrototype), constructorKey, lightweightSetFunction);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
SetFrozenFunction(thread, funcPrototype, "add", ContainersLightWeightSet::Add, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, funcPrototype, "addAll", ContainersLightWeightSet::AddAll, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, funcPrototype, "isEmpty", ContainersLightWeightSet::IsEmpty, FuncLength::ONE);
|
||||
@ -502,7 +505,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeTreeMap(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(mapFuncPrototype), constructorKey, mapFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
// TreeMap.prototype
|
||||
SetFrozenFunction(thread, mapFuncPrototype, "set", ContainersTreeMap::Set, FuncLength::TWO);
|
||||
SetFrozenFunction(thread, mapFuncPrototype, "get", ContainersTreeMap::Get, FuncLength::ONE);
|
||||
@ -579,7 +582,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeTreeSet(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(setFuncPrototype), constructorKey, setFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
// TreeSet.prototype
|
||||
SetFrozenFunction(thread, setFuncPrototype, "add", ContainersTreeSet::Add, FuncLength::TWO);
|
||||
SetFrozenFunction(thread, setFuncPrototype, "remove", ContainersTreeSet::Remove, FuncLength::ONE);
|
||||
@ -654,6 +657,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializePlainArray(JSThread *thread
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(plainArrayFuncPrototype), constructorKey,
|
||||
plainArrayFunction);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
// PlainArray.prototype.add()
|
||||
SetFrozenFunction(thread, plainArrayFuncPrototype, "add", ContainersPlainArray::Add, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, plainArrayFuncPrototype, "clear", ContainersPlainArray::Clear, FuncLength::ONE);
|
||||
@ -727,7 +731,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeStack(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(stackFuncPrototype), constructorKey, stackFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
// Stack.prototype.push()
|
||||
SetFrozenFunction(thread, stackFuncPrototype, "push", ContainersStack::Push, FuncLength::ONE);
|
||||
// Stack.prototype.empty()
|
||||
@ -786,7 +790,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeVector(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(prototype), constructorKey, vectorFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
// Vector.prototype
|
||||
SetFrozenFunction(thread, prototype, "add", ContainersVector::Add, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, prototype, "insert", ContainersVector::Insert, FuncLength::TWO);
|
||||
@ -868,7 +872,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeQueue(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(queueFuncPrototype), constructorKey, queueFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
// Queue.prototype.add()
|
||||
SetFrozenFunction(thread, queueFuncPrototype, "add", ContainersQueue::Add, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, queueFuncPrototype, "getFirst", ContainersQueue::GetFirst, FuncLength::ZERO);
|
||||
@ -923,7 +927,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeDeque(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(dequeFuncPrototype), constructorKey, dequeFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
SetFrozenFunction(thread, dequeFuncPrototype, "insertFront", ContainersDeque::InsertFront, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, dequeFuncPrototype, "insertEnd", ContainersDeque::InsertEnd, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, dequeFuncPrototype, "getFirst", ContainersDeque::GetFirst, FuncLength::ZERO);
|
||||
@ -976,7 +980,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeList(JSThread *thread)
|
||||
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(listFuncPrototype), constructorKey, listFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
SetFrozenFunction(thread, listFuncPrototype, "add", ContainersList::Add, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, listFuncPrototype, "getFirst", ContainersList::GetFirst, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, listFuncPrototype, "getLast", ContainersList::GetLast, FuncLength::ONE);
|
||||
@ -1027,7 +1031,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeLinkedList(JSThread *thread
|
||||
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(linkedListFuncPrototype), constructorKey, linkedListFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
SetFrozenFunction(thread, linkedListFuncPrototype, "add", ContainersLinkedList::Add, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, linkedListFuncPrototype, "insert", ContainersLinkedList::Insert, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, linkedListFuncPrototype, "clear", ContainersLinkedList::Clear, FuncLength::ONE);
|
||||
@ -1114,6 +1118,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeHashMap(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(hashMapFuncPrototype), constructorKey, hashMapFunction);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
// HashMap.prototype.set()
|
||||
SetFrozenFunction(thread, hashMapFuncPrototype, "set", ContainersHashMap::Set, FuncLength::TWO);
|
||||
// HashMap.prototype.setall()
|
||||
@ -1197,7 +1202,7 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeHashSet(JSThread *thread)
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(hashSetFuncPrototype), constructorKey, hashSetFunction);
|
||||
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
SetFrozenFunction(thread, hashSetFuncPrototype, "isEmpty", ContainersHashSet::IsEmpty, FuncLength::ZERO);
|
||||
SetFrozenFunction(thread, hashSetFuncPrototype, "has", ContainersHashSet::Has, FuncLength::ONE);
|
||||
SetFrozenFunction(thread, hashSetFuncPrototype, "add", ContainersHashSet::Add, FuncLength::ONE);
|
||||
|
@ -628,6 +628,7 @@ void EcmaContext::PrintJSErrorInfo(JSThread *thread, const JSHandle<JSTaggedValu
|
||||
{
|
||||
JSHandle<JSTaggedValue> nameKey = thread->GlobalConstants()->GetHandledNameString();
|
||||
JSHandle<JSTaggedValue> nameValue = JSObject::GetProperty(thread, exceptionInfo, nameKey).GetValue();
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<EcmaString> name = JSTaggedValue::ToString(thread, nameValue);
|
||||
// JSTaggedValue::ToString may cause exception. In this case, do not return, use "<error>" instead.
|
||||
if (thread->HasPendingException()) {
|
||||
@ -636,6 +637,7 @@ void EcmaContext::PrintJSErrorInfo(JSThread *thread, const JSHandle<JSTaggedValu
|
||||
}
|
||||
JSHandle<JSTaggedValue> msgKey = thread->GlobalConstants()->GetHandledMessageString();
|
||||
JSHandle<JSTaggedValue> msgValue = JSObject::GetProperty(thread, exceptionInfo, msgKey).GetValue();
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<EcmaString> msg = JSTaggedValue::ToString(thread, msgValue);
|
||||
// JSTaggedValue::ToString may cause exception. In this case, do not return, use "<error>" instead.
|
||||
if (thread->HasPendingException()) {
|
||||
@ -644,6 +646,7 @@ void EcmaContext::PrintJSErrorInfo(JSThread *thread, const JSHandle<JSTaggedValu
|
||||
}
|
||||
JSHandle<JSTaggedValue> stackKey = thread->GlobalConstants()->GetHandledStackString();
|
||||
JSHandle<JSTaggedValue> stackValue = JSObject::GetProperty(thread, exceptionInfo, stackKey).GetValue();
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<EcmaString> stack = JSTaggedValue::ToString(thread, stackValue);
|
||||
// JSTaggedValue::ToString may cause exception. In this case, do not return, use "<error>" instead.
|
||||
if (thread->HasPendingException()) {
|
||||
|
@ -189,6 +189,7 @@ JSTaggedValue LoadICRuntime::LoadValueMiss(JSHandle<JSTaggedValue> receiver, JSH
|
||||
}
|
||||
ObjectOperator op(GetThread(), receiver, key);
|
||||
auto result = JSHandle<JSTaggedValue>(thread_, JSObject::GetProperty(GetThread(), &op));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_);
|
||||
|
||||
if (receiver->IsString()) {
|
||||
// do not cache element
|
||||
@ -287,6 +288,7 @@ JSTaggedValue LoadICRuntime::LoadTypedArrayValueMiss(JSHandle<JSTaggedValue> rec
|
||||
} else {
|
||||
ObjectOperator op(GetThread(), receiver, key);
|
||||
auto result = JSHandle<JSTaggedValue>(GetThread(), JSObject::GetProperty(GetThread(), &op));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(GetThread());
|
||||
if (op.GetValue().IsInternalAccessor()) {
|
||||
op = ObjectOperator(GetThread(), receiver, key);
|
||||
}
|
||||
|
@ -1090,11 +1090,13 @@ void JSDateTimeFormat::ResolvedOptions(JSThread *thread, const JSHandle<JSDateTi
|
||||
property = globalConst->GetHandledDateStyleString();
|
||||
hcValue = ToDateTimeStyleEcmaString(thread, dateTimeFormat->GetDateStyle());
|
||||
JSObject::CreateDataPropertyOrThrow(thread, options, property, hcValue);
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
if (dateTimeFormat->GetTimeStyle() != DateTimeStyleOption::UNDEFINED) {
|
||||
property = globalConst->GetHandledTimeStyleString();
|
||||
hcValue = ToDateTimeStyleEcmaString(thread, dateTimeFormat->GetTimeStyle());
|
||||
JSObject::CreateDataPropertyOrThrow(thread, options, property, hcValue);
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1270,6 +1272,7 @@ JSHandle<JSArray> JSDateTimeFormat::ConstructFDateIntervalToJSArray(JSThread *th
|
||||
element = JSLocale::PutElement(thread, part.index, array, ConvertFieldIdToDateType(thread, part.fField),
|
||||
JSHandle<JSTaggedValue>::Cast(substring));
|
||||
}
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread);
|
||||
JSHandle<JSTaggedValue> value = JSHandle<JSTaggedValue>::Cast(
|
||||
ToValueString(thread, TrackValue(part.fBeginIndex, part.fEndIndex, begin, end)));
|
||||
JSObject::SetProperty(thread, element, thread->GlobalConstants()->GetHandledSourceString(), value, true);
|
||||
|
@ -65,6 +65,7 @@ bool JSForInIterator::HasProperty(JSThread *thread, JSHandle<JSTaggedValue> rece
|
||||
while (current->IsHeapObject()) {
|
||||
PropertyDescriptor desc(thread);
|
||||
bool has = JSTaggedValue::GetOwnProperty(thread, current, key, desc);
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
|
||||
if (has && desc.IsEnumerable()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -169,7 +169,8 @@ JSTaggedValue JSFunction::NameGetter(JSThread *thread, const JSHandle<JSObject>
|
||||
JSHandle<JSTaggedValue> nameKey = globalConst->GetHandledNameString();
|
||||
JSHandle<JSTaggedValue> boundName = thread->GlobalConstants()->GetHandledBoundString();
|
||||
JSHandle<JSTaggedValue> targetName = JSObject::GetProperty(thread, target, nameKey).GetValue();
|
||||
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
JSHandle<EcmaString> handlePrefixString = JSTaggedValue::ToString(thread, boundName);
|
||||
JSHandle<EcmaString> spaceString(globalConst->GetHandledSpaceString());
|
||||
JSHandle<EcmaString> concatString = factory->ConcatFromString(handlePrefixString, spaceString);
|
||||
|
@ -63,9 +63,8 @@ JSHandle<JSTaggedValue> JSIterator::GetIterator(JSThread *thread, const JSHandle
|
||||
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
|
||||
EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, method, obj, undefined, 0);
|
||||
JSTaggedValue ret = JSFunction::Call(info);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
JSHandle<JSTaggedValue> iter(thread, ret);
|
||||
// 4.ReturnIfAbrupt(iterator).
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, iter);
|
||||
// 5.If Type(iterator) is not Object, throw a TypeError exception
|
||||
if (!iter->IsECMAObject()) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, "JSIterator::GetIterator: iter is not object", undefined);
|
||||
@ -86,6 +85,7 @@ JSHandle<JSTaggedValue> JSIterator::GetAsyncIterator(JSThread *thread, const JSH
|
||||
if (method->IsUndefined()) {
|
||||
JSHandle<JSTaggedValue> iteratorSymbol = env->GetIteratorSymbol();
|
||||
JSHandle<JSTaggedValue> func = JSObject::GetMethod(thread, obj, iteratorSymbol);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
JSHandle<JSTaggedValue> syncIterator = GetIterator(thread, obj, func);
|
||||
JSHandle<JSTaggedValue> nextStr = thread->GlobalConstants()->GetHandledNextString();
|
||||
JSHandle<JSTaggedValue> nextMethod = JSTaggedValue::GetProperty(thread, syncIterator, nextStr).GetValue();
|
||||
|
@ -838,6 +838,7 @@ void GroupToParts(JSThread *thread, const icu::number::FormattedNumber &formatte
|
||||
JSHandle<EcmaString> substring =
|
||||
intl::LocaleHelper::UStringToString(thread, formattedText, previousLimit, formattedText.length());
|
||||
JSLocale::PutElement(thread, index, receiver, typeString, JSHandle<JSTaggedValue>::Cast(substring));
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1056,5 +1057,6 @@ void JSNumberFormat::ResolvedOptions(JSThread *thread, const JSHandle<JSNumberFo
|
||||
SignDisplayOption signDisplay = numberFormat->GetSignDisplay();
|
||||
JSHandle<JSTaggedValue> signDisplayString = OptionToEcmaString(thread, signDisplay);
|
||||
JSObject::CreateDataPropertyOrThrow(thread, options, property, signDisplayString);
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
} // namespace panda::ecmascript
|
@ -376,5 +376,6 @@ void JSPluralRules::ResolvedOptions(JSThread *thread, const JSHandle<JSPluralRul
|
||||
property = globalConst->GetHandledPluralCategoriesString();
|
||||
JSHandle<JSArray> jsPluralCategories = JSArray::CreateArrayFromList(thread, pluralCategories);
|
||||
JSObject::CreateDataPropertyOrThrow(thread, options, property, JSHandle<JSTaggedValue>::Cast(jsPluralCategories));
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -86,6 +86,7 @@ JSTaggedValue JSRegExpIterator::Next(EcmaRuntimeCallInfo *argv)
|
||||
JSHandle<JSTaggedValue> lastIndexString(globalConstants->GetHandledLastIndexString());
|
||||
JSHandle<JSTaggedValue> getLastIndex(JSObject::GetProperty(thread, regexHandle,
|
||||
lastIndexString).GetValue());
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSTaggedNumber thisIndex = JSTaggedValue::ToLength(thread, getLastIndex);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
uint32_t nextIndex = BuiltinsRegExp::AdvanceStringIndex(inputStr, thisIndex.ToUint32(),
|
||||
|
@ -991,6 +991,7 @@ Local<MapIteratorRef> MapIteratorRef::New(const EcmaVM *vm, Local<MapRef> map)
|
||||
IterationKind iterKind = IterationKind::KEY_AND_VALUE;
|
||||
JSHandle<JSTaggedValue> mapIteratorKeyAndValue =
|
||||
JSMapIterator::CreateMapIterator(vm->GetJSThread(), JSHandle<JSTaggedValue>::Cast(jsMap), iterKind);
|
||||
RETURN_VALUE_IF_ABRUPT(thread, JSValueRef::Undefined(vm));
|
||||
return JSNApiHelper::ToLocal<JSValueRef>(mapIteratorKeyAndValue);
|
||||
}
|
||||
|
||||
@ -1010,6 +1011,7 @@ Local<ArrayRef> MapIteratorRef::Next(const EcmaVM *vm, ecmascript::EcmaRuntimeCa
|
||||
{
|
||||
CROSS_THREAD_AND_EXCEPTION_CHECK_WITH_RETURN(vm, JSValueRef::Undefined(vm));
|
||||
JSHandle<JSTaggedValue> nextTagValResult(vm->GetJSThread(), JSMapIterator::Next(ecmaRuntimeCallInfo));
|
||||
RETURN_VALUE_IF_ABRUPT(thread, JSValueRef::Undefined(vm));
|
||||
JSHandle<JSTaggedValue> iteratorVal(vm->GetJSThread(),
|
||||
JSIterator::IteratorValue(vm->GetJSThread(), nextTagValResult).GetTaggedValue());
|
||||
return JSNApiHelper::ToLocal<ArrayRef>(iteratorVal);
|
||||
@ -1053,6 +1055,7 @@ Local<SetIteratorRef> SetIteratorRef::New(const EcmaVM *vm, Local<SetRef> set)
|
||||
IterationKind iterKind = IterationKind::KEY_AND_VALUE;
|
||||
JSHandle<JSTaggedValue> setIteratorKeyAndValue =
|
||||
JSSetIterator::CreateSetIterator(vm->GetJSThread(), JSHandle<JSTaggedValue>::Cast(jsSet), iterKind);
|
||||
RETURN_VALUE_IF_ABRUPT(thread, JSValueRef::Undefined(vm));
|
||||
return JSNApiHelper::ToLocal<JSValueRef>(setIteratorKeyAndValue);
|
||||
}
|
||||
|
||||
@ -1072,6 +1075,7 @@ Local<ArrayRef> SetIteratorRef::Next(const EcmaVM *vm, ecmascript::EcmaRuntimeCa
|
||||
{
|
||||
CROSS_THREAD_AND_EXCEPTION_CHECK_WITH_RETURN(vm, JSValueRef::Undefined(vm));
|
||||
JSHandle<JSTaggedValue> nextTagValResult(vm->GetJSThread(), JSSetIterator::Next(ecmaRuntimeCallInfo));
|
||||
RETURN_VALUE_IF_ABRUPT(thread, JSValueRef::Undefined(vm));
|
||||
JSHandle<JSTaggedValue> iteratorVal(vm->GetJSThread(),
|
||||
JSIterator::IteratorValue(vm->GetJSThread(), nextTagValResult).GetTaggedValue());
|
||||
return JSNApiHelper::ToLocal<ArrayRef>(iteratorVal);
|
||||
@ -1180,6 +1184,7 @@ Local<PromiseCapabilityRef> PromiseCapabilityRef::New(const EcmaVM *vm)
|
||||
JSHandle<GlobalEnv> globalEnv = vm->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> constructor(globalEnv->GetPromiseFunction());
|
||||
JSHandle<JSTaggedValue> capability(JSPromise::NewPromiseCapability(thread, constructor));
|
||||
RETURN_VALUE_IF_ABRUPT(thread, JSValueRef::Undefined(vm));
|
||||
return JSNApiHelper::ToLocal<PromiseCapabilityRef>(capability);
|
||||
}
|
||||
|
||||
|
@ -917,6 +917,7 @@ JSHandle<JSObject> ObjectFactory::NewJSError(const ErrorType &errorType, const J
|
||||
JSHandle<JSTaggedValue> nativePrototype(thread_, nativeFunc->GetFunctionPrototype());
|
||||
JSHandle<JSTaggedValue> ctorKey = globalConst->GetHandledConstructorString();
|
||||
JSHandle<JSTaggedValue> ctor(JSTaggedValue::GetProperty(thread_, nativePrototype, ctorKey).GetValue());
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSObject, thread_);
|
||||
JSHandle<JSTaggedValue> undefined = thread_->GlobalConstants()->GetHandledUndefined();
|
||||
EcmaRuntimeCallInfo *info =
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread_, ctor, nativePrototype, undefined, 1, needCheckStack);
|
||||
|
@ -559,6 +559,7 @@ JSTaggedValue ObjectFastOperator::FastGetPropertyByIndex(JSThread *thread, JSTag
|
||||
{
|
||||
INTERPRETER_TRACE(thread, FastGetPropertyByIndex);
|
||||
JSTaggedValue result = ObjectFastOperator::GetPropertyByIndex(thread, receiver, index);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
if (result.IsHole()) {
|
||||
return JSTaggedValue::GetProperty(thread,
|
||||
JSHandle<JSTaggedValue>(thread, receiver), index).GetValue().GetTaggedValue();
|
||||
|
@ -82,6 +82,7 @@ void ObjectOperator::HandleKey(const JSHandle<JSTaggedValue> &key)
|
||||
}
|
||||
|
||||
JSHandle<JSTaggedValue> keyHandle(thread_, JSTaggedValue::ToPrimitive(thread_, key, PREFER_STRING));
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread_);
|
||||
if (key->IsSymbol()) {
|
||||
key_ = keyHandle;
|
||||
return;
|
||||
@ -641,6 +642,7 @@ bool ObjectOperator::UpdateDataValue(const JSHandle<JSObject> &receiver, const J
|
||||
JSType jsType = holder.GetTaggedObject()->GetClass()->GetObjectType();
|
||||
JSTaggedValue typedArrayProperty = JSTypedArray::FastSetPropertyByIndex(thread_,
|
||||
receiver.GetTaggedValue(), GetIndex(), value.GetTaggedValue(), jsType);
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false);
|
||||
if (typedArrayProperty.IsHole()) {
|
||||
return false;
|
||||
}
|
||||
@ -924,6 +926,7 @@ void ObjectOperator::LookupElementInlinedProps(const JSHandle<JSObject> &obj)
|
||||
if (obj->IsTypedArray()) {
|
||||
JSTaggedValue val = JSTypedArray::FastElementGet(thread_,
|
||||
JSHandle<JSTaggedValue>::Cast(obj), elementIndex_).GetValue().GetTaggedValue();
|
||||
RETURN_IF_ABRUPT_COMPLETION(thread_);
|
||||
if (!val.IsHole()) {
|
||||
SetFound(elementIndex_, val, PropertyAttributes::GetDefaultAttributes(), true);
|
||||
}
|
||||
|
@ -494,6 +494,7 @@ JSTaggedValue RuntimeStubs::RuntimeStArraySpread(JSThread *thread, const JSHandl
|
||||
break;
|
||||
}
|
||||
bool success = JSTaggedValue::GetOwnProperty(thread, iterResult, valueStr, desc);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
if (success && desc.IsEnumerable()) {
|
||||
JSTaggedValue::DefineOwnProperty(thread, dst, indexHandle, desc);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
@ -2389,6 +2390,7 @@ JSTaggedValue RuntimeStubs::RuntimeGetCallSpreadArgs(JSThread *thread, const JSH
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<TaggedArray> argv = factory->NewTaggedArray(argvMayMaxLength);
|
||||
JSHandle<JSTaggedValue> itor = JSIterator::GetIterator(thread, jsArray);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
// Fast path when array is stablearray and Iterator not change.
|
||||
if (jsArray->IsStableJSArray(thread) && itor->IsJSArrayIterator()) {
|
||||
@ -3031,6 +3033,7 @@ JSTaggedValue RuntimeStubs::RuntimeDefinePrivateProperty(JSThread *thread, JSTag
|
||||
}
|
||||
bool result = JSObject::CreateDataPropertyOrThrow(thread, JSHandle<JSObject>::Cast(handleObj),
|
||||
handleKey, handleValue);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
if (!extensible) {
|
||||
handleObj->GetTaggedObject()->GetClass()->SetExtensible(false);
|
||||
}
|
||||
|
@ -2489,6 +2489,7 @@ DEF_RUNTIME_STUBS(VerifyVTableLoading)
|
||||
JSHandle<JSTaggedValue> typedPathValue = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
|
||||
|
||||
JSHandle<JSTaggedValue> verifiedPathValue = JSTaggedValue::GetProperty(thread, receiver, key).GetValue();
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
||||
if (UNLIKELY(!JSTaggedValue::SameValue(typedPathValue, verifiedPathValue))) {
|
||||
std::ostringstream oss;
|
||||
receiver->Dump(oss);
|
||||
@ -2516,6 +2517,7 @@ DEF_RUNTIME_STUBS(VerifyVTableStoring)
|
||||
JSHandle<JSTaggedValue> storeValue = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
|
||||
|
||||
JSHandle<JSTaggedValue> verifiedValue = JSTaggedValue::GetProperty(thread, receiver, key).GetValue();
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
||||
if (UNLIKELY(!JSTaggedValue::SameValue(storeValue, verifiedValue))) {
|
||||
std::ostringstream oss;
|
||||
receiver->Dump(oss);
|
||||
@ -2541,6 +2543,7 @@ DEF_RUNTIME_STUBS(JSObjectGetMethod)
|
||||
JSHandle<JSTaggedValue> obj(thread, GetArg(argv, argc, 0));
|
||||
JSHandle<JSTaggedValue> key(thread, GetArg(argv, argc, 1));
|
||||
JSHandle<JSTaggedValue> result = JSObject::GetMethod(thread, obj, key);
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
||||
return result->GetRawData();
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ JSHandle<JSTaggedValue> TemplateString::GetTemplateObject(JSThread *thread, JSHa
|
||||
{
|
||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||
JSHandle<JSTaggedValue> rawStringsTag = JSObject::GetProperty(thread, templateLiteral, 0).GetValue();
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
JSHandle<JSTaggedValue> templateMapTag = env->GetTemplateMap();
|
||||
JSHandle<TemplateMap> templateMap(templateMapTag);
|
||||
int32_t element = templateMap->FindEntry(rawStringsTag.GetTaggedValue());
|
||||
@ -35,6 +36,7 @@ JSHandle<JSTaggedValue> TemplateString::GetTemplateObject(JSThread *thread, JSHa
|
||||
return JSHandle<JSTaggedValue>(thread, templateMap->GetValue(element));
|
||||
}
|
||||
JSHandle<JSTaggedValue> cookedStringsTag = JSObject::GetProperty(thread, templateLiteral, 1).GetValue();
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
JSHandle<JSArray> cookedStrings(cookedStringsTag);
|
||||
uint32_t count = cookedStrings->GetArrayLength();
|
||||
auto countNum = JSTaggedNumber(count);
|
||||
@ -46,9 +48,11 @@ JSHandle<JSTaggedValue> TemplateString::GetTemplateObject(JSThread *thread, JSHa
|
||||
JSHandle<JSObject> rawObj(rawArr);
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
JSHandle<JSTaggedValue> cookedValue = JSObject::GetProperty(thread, cookedStringsTag, i).GetValue();
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
PropertyDescriptor descCooked(thread, cookedValue, true, false, false);
|
||||
JSArray::DefineOwnProperty(thread, templateObj, i, descCooked);
|
||||
JSHandle<JSTaggedValue> rawValue = JSObject::GetProperty(thread, rawStringsTag, i).GetValue();
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
PropertyDescriptor descRaw(thread, rawValue, true, false, false);
|
||||
JSArray::DefineOwnProperty(thread, rawObj, i, descRaw);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user