Fix THROW_TYPE_ERROR_AND_RETURN Part 1

Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7JU9Q

Signed-off-by: 王笑佳 <wangxiaojia5@huawei.com>
This commit is contained in:
王笑佳 2023-07-10 10:16:29 +08:00
parent d852d04892
commit f2c60fbed0
62 changed files with 169 additions and 8 deletions

View File

@ -187,6 +187,7 @@ JSTaggedValue ArrayHelper::FlattenIntoArray(JSThread *thread, const JSHandle<JSO
while (sourceIndex < args.sourceLen) {
sourceIndexHandle.Update(JSTaggedValue(sourceIndex));
sourceIndexStr = JSTaggedValue::ToString(thread, sourceIndexHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
p.Update(sourceIndexStr.GetTaggedValue());
bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, p);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -227,6 +228,7 @@ JSTaggedValue ArrayHelper::FlattenIntoArray(JSThread *thread, const JSHandle<JSO
}
sourceIndexHandle.Update(JSTaggedValue(tempArgs.start));
sourceIndexStr = JSTaggedValue::ToString(thread, sourceIndexHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
targetIndexHandle.Update(sourceIndexStr.GetTaggedValue());
JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, targetIndexHandle, element);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);

View File

@ -22,9 +22,11 @@ JSHandle<JSTaggedValue> Internalize::InternalizeJsonProperty(JSThread *thread, c
{
JSHandle<JSTaggedValue> objHandle(holder);
JSHandle<JSTaggedValue> val = JSTaggedValue::GetProperty(thread, objHandle, name).GetValue();
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
JSHandle<JSTaggedValue> lengthKey = thread->GlobalConstants()->GetHandledLengthString();
if (val->IsECMAObject()) {
JSHandle<JSObject> obj = JSTaggedValue::ToObject(thread, val);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
bool isArray = val->IsArray(thread);
if (isArray) {
JSHandle<JSTaggedValue> lenResult = JSTaggedValue::GetProperty(thread, val, lengthKey).GetValue();
@ -38,6 +40,7 @@ JSHandle<JSTaggedValue> Internalize::InternalizeJsonProperty(JSThread *thread, c
// Let prop be ! ToString((I)).
keyUnknow.Update(JSTaggedValue(i));
keyName.Update(JSTaggedValue::ToString(thread, keyUnknow).GetTaggedValue());
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
RecurseAndApply(thread, obj, keyName, receiver);
}
} else {

View File

@ -385,6 +385,7 @@ private:
// slow path
JSTaggedValue::SetProperty(thread_, JSHandle<JSTaggedValue>(result), keyHandle,
JSHandle<JSTaggedValue>(thread_, value), true);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_);
}
GetNextNonSpaceChar();
if (*current_ == ',') {

View File

@ -477,6 +477,7 @@ bool JsonStringifier::SerializeJSONObject(const JSHandle<JSTaggedValue> &value,
for (uint32_t i = 0; i < arrLength; i++) {
handleKey_.Update(propertyArray->Get(i));
JSHandle<JSTaggedValue> valueHandle = JSTaggedValue::GetProperty(thread_, value, handleKey_).GetValue();
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false);
JSTaggedValue serializeValue = GetSerializeValue(value, handleKey_, valueHandle, replacer);
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false);
if (UNLIKELY(serializeValue.IsUndefined() || serializeValue.IsSymbol() ||

View File

@ -154,6 +154,7 @@ JSTaggedValue TypedArrayHelper::CreateFromOrdinaryObject(EcmaRuntimeCallInfo *ar
while (k < len) {
tKey.Update(JSTaggedValue(k));
JSHandle<JSTaggedValue> kKey(JSTaggedValue::ToString(thread, tKey));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> kValue = vec[k];
JSTaggedValue::SetProperty(thread, JSHandle<JSTaggedValue>::Cast(obj), kKey, kValue, true);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -187,6 +188,7 @@ JSTaggedValue TypedArrayHelper::CreateFromOrdinaryObject(EcmaRuntimeCallInfo *ar
while (k < len) {
tKey.Update(JSTaggedValue(k));
JSHandle<JSTaggedValue> kKey(JSTaggedValue::ToString(thread, tKey));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> kValue = JSObject::GetProperty(thread, objectArg, kKey).GetValue();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSTaggedValue::SetProperty(thread, JSHandle<JSTaggedValue>::Cast(obj), kKey, kValue, true);

View File

@ -38,6 +38,7 @@ JSTaggedValue BuiltinsArkTools::ObjectDump(EcmaRuntimeCallInfo *info)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle<EcmaString> str = JSTaggedValue::ToString(thread, GetCallArg(info, 0));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// The default log level of ace_engine and js_runtime is error
LOG_ECMA(ERROR) << ": " << EcmaStringAccessor(str).ToStdString();
@ -209,6 +210,7 @@ JSTaggedValue BuiltinsArkTools::StartCpuProfiler(EcmaRuntimeCallInfo *info)
std::string fileName = "";
if (fileNameValue->IsString()) {
JSHandle<EcmaString> str = JSTaggedValue::ToString(thread, fileNameValue);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
fileName = EcmaStringAccessor(str).ToStdString() + ".cpuprofile";
} else {
fileName = GetProfileName();

View File

@ -644,6 +644,7 @@ JSTaggedValue BuiltinsArray::CopyWithin(EcmaRuntimeCallInfo *argv)
} else {
if (thisObjVal->IsJSProxy()) {
toKey.Update(JSTaggedValue::ToString(thread, toKey).GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, toKey);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -2369,6 +2370,7 @@ JSTaggedValue BuiltinsArray::Splice(EcmaRuntimeCallInfo *argv)
toKey.Update(JSTaggedValue(k));
if (newArrayHandle->IsJSProxy()) {
toKey.Update(JSTaggedValue::ToString(thread, toKey).GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, toKey, fromValue);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -2914,6 +2916,7 @@ JSTaggedValue BuiltinsArray::Includes(EcmaRuntimeCallInfo *argv)
while (from < len) {
JSHandle<JSTaggedValue> handledFrom(thread, JSTaggedValue(from));
fromStr = JSTaggedValue::ToString(thread, handledFrom);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
key.Update(fromStr.GetTaggedValue());
kValueHandle.Update(JSArray::FastGetPropertyByValue(thread, thisObjVal, key).GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);

View File

@ -184,6 +184,7 @@ JSTaggedValue BuiltinsAggregateError::AggregateErrorConstructor(EcmaRuntimeCallI
JSHandle<JSTaggedValue> errorsValues(JSArray::CreateArrayFromList(thread, errorsArray));
PropertyDescriptor msgDesc(thread, errorsValues, true, false, true);
JSTaggedValue::DefinePropertyOrThrow(thread, taggedObj, errorsKey, msgDesc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// 6. Return O.
return taggedObj.GetTaggedValue();
}

View File

@ -206,6 +206,7 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeBind(EcmaRuntimeCallInfo *argv)
PropertyDescriptor desc(thread, JSHandle<JSTaggedValue>(thread, JSTaggedValue(lengthValue)), false, false, true);
[[maybe_unused]] bool status =
JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle<JSTaggedValue>(boundFunction), lengthKey, desc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// 11. Assert: status is not an abrupt completion.
ASSERT_PRINT(status, "DefinePropertyOrThrow failed");

View File

@ -40,6 +40,7 @@ JSTaggedValue BuiltinsGenerator::GeneratorPrototypeNext(EcmaRuntimeCallInfo *arg
THROW_TYPE_ERROR_AND_RETURN(thread, "Not a generator object.", JSTaggedValue::Exception());
}
JSHandle<JSGeneratorObject> generator(thread, JSGeneratorObject::Cast(*JSTaggedValue::ToObject(thread, msg)));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
// 2.Return ? GeneratorResume(g, value).
@ -60,7 +61,7 @@ JSTaggedValue BuiltinsGenerator::GeneratorPrototypeReturn(EcmaRuntimeCallInfo *a
THROW_TYPE_ERROR_AND_RETURN(thread, "Not a generator object.", JSTaggedValue::Exception());
}
JSHandle<JSGeneratorObject> generator(thread, JSGeneratorObject::Cast(*JSTaggedValue::ToObject(thread, msg)));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// 2.Let C be Completion { [[Type]]: return, [[Value]]: value, [[Target]]: empty }.
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
@ -85,7 +86,7 @@ JSTaggedValue BuiltinsGenerator::GeneratorPrototypeThrow(EcmaRuntimeCallInfo *ar
THROW_TYPE_ERROR_AND_RETURN(thread, "Not a generator object.", JSTaggedValue::Exception());
}
JSHandle<JSGeneratorObject> generator(thread, JSGeneratorObject::Cast(*JSTaggedValue::ToObject(thread, msg)));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// 2.Let C be ThrowCompletion(exception).
JSHandle<JSTaggedValue> exception = GetCallArg(argv, 0);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();

View File

@ -56,6 +56,7 @@ JSTaggedValue BuiltinsLocale::LocaleConstructor(EcmaRuntimeCallInfo *argv)
JSHandle<EcmaString> localeString = factory->GetEmptyString();
if (!tag->IsJSLocale()) {
localeString = JSTaggedValue::ToString(thread, tag);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
} else {
icu::Locale *icuLocale = (JSHandle<JSLocale>::Cast(tag))->GetIcuLocale();
localeString = intl::LocaleHelper::ToLanguageTag(thread, *icuLocale);

View File

@ -134,6 +134,7 @@ JSTaggedValue BuiltinsMap::Has(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSMap", JSTaggedValue::Exception());
}
JSMap *jsMap = JSMap::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> key = GetCallArg(argv, 0);
bool flag = jsMap->Has(key.GetTaggedValue());
return GetTaggedBoolean(flag);
@ -151,6 +152,7 @@ JSTaggedValue BuiltinsMap::Get(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSMap", JSTaggedValue::Exception());
}
JSMap *jsMap = JSMap::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> key = GetCallArg(argv, 0);
JSTaggedValue value = jsMap->Get(key.GetTaggedValue());
return value;
@ -228,6 +230,7 @@ JSTaggedValue BuiltinsMap::GetSize(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSMap", JSTaggedValue::Exception());
}
JSMap *jsMap = JSMap::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
int count = jsMap->GetSize();
return JSTaggedValue(count);
}

View File

@ -730,6 +730,7 @@ JSTaggedValue BuiltinsObject::IsPrototypeOf(EcmaRuntimeCallInfo *argv)
return GetTaggedBoolean(true);
}
msgValueHandle.Update(JSTaggedValue::GetPrototype(thread, msgValueHandle));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
return GetTaggedBoolean(false);
}
@ -874,6 +875,7 @@ JSTaggedValue BuiltinsObject::ToString(EcmaRuntimeCallInfo *argv)
JSHandle<EcmaString> newLeftStringHandle =
factory->ConcatFromString(leftString, JSTaggedValue::ToString(thread, tag));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
auto result = factory->ConcatFromString(newLeftStringHandle, rightString);
return result.GetTaggedValue();
}

View File

@ -759,6 +759,7 @@ JSHandle<CompletionRecord> BuiltinsPromise::PerformPromiseAny(JSThread *thread,
PropertyDescriptor msgDesc(thread, errorsValue, true, false, true);
JSHandle<JSTaggedValue> errorTagged = JSHandle<JSTaggedValue>::Cast(error);
JSTaggedValue::DefinePropertyOrThrow(thread, errorTagged, errorsKey, msgDesc);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(CompletionRecord, thread);
// 3. Return ThrowCompletion(error).
JSHandle<JSTaggedValue> errorCompletion(
factory->NewCompletionRecord(CompletionRecordType::THROW, errorTagged));

View File

@ -550,6 +550,7 @@ JSTaggedValue BuiltinsPromiseHandler::AnyRejectElementFunction(EcmaRuntimeCallIn
PropertyDescriptor msgDesc(thread, errorsValue, true, false, true);
JSHandle<JSTaggedValue> errorTagged = JSHandle<JSTaggedValue>::Cast(error);
JSTaggedValue::DefinePropertyOrThrow(thread, errorTagged, errorsKey, msgDesc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// c. Return ? Call(promiseCapability.[[Reject]], undefined, « error »).
JSHandle<JSTaggedValue> capaReject(thread, capa->GetReject());
JSHandle<JSTaggedValue> undefined(globalConst->GetHandledUndefined());

View File

@ -95,6 +95,7 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv)
// 5.c Else, let F be flags.
flagsTemp = JSHandle<JSTaggedValue>(thread, *JSTaggedValue::ToString(thread, flags));
}
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// 6. Else if patternIsRegExp is true
} else if (patternIsRegExp) {
JSHandle<JSTaggedValue> sourceString(globalConst->GetHandledSourceString());
@ -114,6 +115,7 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv)
} else {
// 6.d Else, let F be flags.
flagsTemp = JSHandle<JSTaggedValue>(thread, *JSTaggedValue::ToString(thread, flags));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
} else {
// 7.a Let P be pattern.
@ -123,6 +125,7 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv)
flagsTemp = flags;
} else {
flagsTemp = JSHandle<JSTaggedValue>(thread, *JSTaggedValue::ToString(thread, flags));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
}
// 8. Let O be RegExpAlloc(newTarget).
@ -377,6 +380,7 @@ JSTaggedValue BuiltinsRegExp::Match(EcmaRuntimeCallInfo *argv)
// 3. Let S be ToString(string)
JSHandle<JSTaggedValue> inputString = GetCallArg(argv, 0);
JSHandle<EcmaString> stringHandle = JSTaggedValue::ToString(thread, inputString);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
bool useCache = true;
JSHandle<RegExpExecResultCache> cacheTable(thread->GetCurrentEcmaContext()->GetRegExpCache());
if (cacheTable->GetLargeStrCount() == 0 || cacheTable->GetConflictCount() == 0) {
@ -1437,6 +1441,7 @@ JSTaggedValue BuiltinsRegExp::RegExpBuiltinExec(JSThread *thread, const JSHandle
return JSTaggedValue::Null();
}
JSHandle<EcmaString> inputString = JSTaggedValue::ToString(thread, inputStr);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
bool isUtf16 = EcmaStringAccessor(inputString).IsUtf16();
auto inputPtr = EcmaStringAccessor(inputString).ToOneByteDataForced();
const uint8_t *strBuffer = inputPtr.get();
@ -1548,7 +1553,7 @@ JSTaggedValue BuiltinsRegExp::RegExpExec(JSThread *thread, const JSHandle<JSTagg
ASSERT(inputString->IsString());
// 3. Let exec be Get(R, "exec").
JSHandle<EcmaString> inputStr = JSTaggedValue::ToString(thread, inputString);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
JSHandle<JSTaggedValue> execHandle = globalConst->GetHandledExecString();
JSTaggedValue execVal = ObjectFastOperator::FastGetPropertyByValue(thread, regexp.GetTaggedValue(),

View File

@ -118,7 +118,7 @@ JSTaggedValue BuiltinsSet::Add(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 0));
JSHandle<JSSet> set(JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSSet::Add(thread, set, value);
return set.GetTaggedValue();
}
@ -137,6 +137,7 @@ JSTaggedValue BuiltinsSet::Clear(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSSet", JSTaggedValue::Exception());
}
JSHandle<JSSet> set(thread, JSSet::Cast(*JSTaggedValue::ToObject(thread, self)));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSSet::Clear(thread, set);
return JSTaggedValue::Undefined();
}
@ -155,6 +156,7 @@ JSTaggedValue BuiltinsSet::Delete(EcmaRuntimeCallInfo *argv)
}
JSHandle<JSSet> set(thread, JSSet::Cast(*JSTaggedValue::ToObject(thread, self)));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
bool flag = JSSet::Delete(thread, set, value);
return GetTaggedBoolean(flag);
@ -173,6 +175,7 @@ JSTaggedValue BuiltinsSet::Has(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSSet", JSTaggedValue::Exception());
}
JSSet *jsSet = JSSet::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
bool flag = jsSet->Has(value.GetTaggedValue());
return GetTaggedBoolean(flag);
@ -250,6 +253,7 @@ JSTaggedValue BuiltinsSet::GetSize(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSSet", JSTaggedValue::Exception());
}
JSSet *jsSet = JSSet::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
int count = jsSet->GetSize();
return JSTaggedValue(count);
}

View File

@ -356,6 +356,7 @@ JSTaggedValue BuiltinsString::Concat(EcmaRuntimeCallInfo *argv)
for (uint32_t i = 0; i < argLength; i++) {
JSHandle<JSTaggedValue> nextTag = BuiltinsString::GetCallArg(argv, i);
JSHandle<EcmaString> nextHandle = JSTaggedValue::ToString(thread, nextTag);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
u16strNext = EcmaStringAccessor(nextHandle).ToU16String();
if (EcmaStringAccessor(nextHandle).IsUtf16()) {
canBeCompress = false;
@ -899,6 +900,7 @@ JSTaggedValue BuiltinsString::Replace(EcmaRuntimeCallInfo *argv)
replHandle.Update(GetSubstitution(thread, searchString, thisString, pos, capturesList, undefined, replacement));
}
JSHandle<EcmaString> realReplaceStr = JSTaggedValue::ToString(thread, replHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// Let tailPos be pos + the number of code units in matched.
int32_t tailPos = pos + static_cast<int32_t>(EcmaStringAccessor(searchString).GetLength());
// Let newString be the String formed by concatenating the first pos code units of string,
@ -1021,6 +1023,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv)
capturesList, undefined, replacement));
}
JSHandle<EcmaString> realReplaceStr = JSTaggedValue::ToString(thread, replHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
// Let tailPos be pos + the number of code units in matched.
// Let newString be the String formed by concatenating the first pos code units of string,
// replStr, and the trailing substring of string starting at index tailPos.
@ -1847,6 +1850,7 @@ JSTaggedValue BuiltinsString::GetLength(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
JSHandle<EcmaString> thisString = JSTaggedValue::ToString(thread, thisHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
return GetTaggedInt(EcmaStringAccessor(thisString).GetLength());
}
@ -1890,6 +1894,7 @@ JSTaggedValue BuiltinsString::Pad(EcmaRuntimeCallInfo *argv, bool isStart)
stringBuilder = u" ";
} else {
JSHandle<EcmaString> filler = JSTaggedValue::ToString(thread, fillString);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
stringBuilder = EcmaStringAccessor(filler).ToU16String();
}
if (stringBuilder.size() == 0) {

View File

@ -110,6 +110,7 @@ JSTaggedValue BuiltinsSymbol::SymbolDescriptiveString(JSThread *thread, JSTagged
JSHandle<EcmaString> rightHandle(factory->NewFromASCII(")"));
JSHandle<EcmaString> stringLeft =
factory->ConcatFromString(leftHandle, JSTaggedValue::ToString(thread, descHandle));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<EcmaString> str = factory->ConcatFromString(stringLeft, rightHandle);
return str.GetTaggedValue();
}

View File

@ -337,6 +337,7 @@ JSTaggedValue BuiltinsTypedArray::Of(EcmaRuntimeCallInfo *argv)
while (k < len) {
tKey.Update(JSTaggedValue(k));
JSHandle<JSTaggedValue> kKey(JSTaggedValue::ToString(thread, tKey));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> kValue = GetCallArg(argv, k);
JSTaggedValue::SetProperty(thread, JSHandle<JSTaggedValue>::Cast(newObj), kKey, kValue, true);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -1116,6 +1117,7 @@ JSTaggedValue BuiltinsTypedArray::Set(EcmaRuntimeCallInfo *argv)
while (targetByteIndex < limit) {
tKey.Update(JSTaggedValue(k));
JSHandle<JSTaggedValue> kKey(JSTaggedValue::ToString(thread, tKey));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
kValue.Update(ObjectFastOperator::FastGetPropertyByValue(
thread, JSHandle<JSTaggedValue>::Cast(src).GetTaggedValue(), kKey.GetTaggedValue()));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);

View File

@ -107,6 +107,7 @@ JSTaggedValue BuiltinsWeakMap::Has(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSWeakMap.", JSTaggedValue::Exception());
}
JSWeakMap *jsWeakMap = JSWeakMap::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> key = GetCallArg(argv, 0);
// 5.if Type(key) is not Object, return false.
if (!key->IsHeapObject()) {
@ -128,6 +129,7 @@ JSTaggedValue BuiltinsWeakMap::Get(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSWeakMap.", JSTaggedValue::Exception());
}
JSWeakMap *jsWeakMap = JSWeakMap::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> key = GetCallArg(argv, 0);
if (!key->IsHeapObject()) {
return JSTaggedValue::Undefined();

View File

@ -128,7 +128,7 @@ JSTaggedValue BuiltinsWeakSet::Add(EcmaRuntimeCallInfo *argv)
}
JSHandle<JSWeakSet> weakSet(thread, JSWeakSet::Cast(*JSTaggedValue::ToObject(thread, self)));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSWeakSet::Add(thread, weakSet, value);
return weakSet.GetTaggedValue();
}
@ -147,6 +147,7 @@ JSTaggedValue BuiltinsWeakSet::Delete(EcmaRuntimeCallInfo *argv)
}
JSHandle<JSWeakSet> weakSet(thread, JSWeakSet::Cast(*JSTaggedValue::ToObject(thread, self)));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
if (!value->IsHeapObject()) {
GetTaggedBoolean(false);
@ -167,6 +168,7 @@ JSTaggedValue BuiltinsWeakSet::Has(EcmaRuntimeCallInfo *argv)
THROW_TYPE_ERROR_AND_RETURN(thread, "obj is not JSWeakSet", JSTaggedValue::Exception());
}
JSWeakSet *jsWeakSet = JSWeakSet::Cast(*JSTaggedValue::ToObject(thread, self));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
if (!value->IsHeapObject()) {
GetTaggedBoolean(false);

View File

@ -94,6 +94,7 @@ JSTaggedValue ContainersArrayList::Insert(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index = GetCallArg(argv, 1);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg = "The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, JSTaggedValue::Exception());
@ -218,6 +219,7 @@ JSTaggedValue ContainersArrayList::IncreaseCapacityTo(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> newCapacity = GetCallArg(argv, 0);
if (!newCapacity->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, newCapacity);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"newCapacity\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -366,6 +368,7 @@ JSTaggedValue ContainersArrayList::RemoveByIndex(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value = GetCallArg(argv, 0);
if (!value->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -429,6 +432,7 @@ JSTaggedValue ContainersArrayList::RemoveByRange(EcmaRuntimeCallInfo *argv)
if (!startIndex->IsInteger()) {
std::ostringstream oss;
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, startIndex);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"fromIndex\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -437,6 +441,7 @@ JSTaggedValue ContainersArrayList::RemoveByRange(EcmaRuntimeCallInfo *argv)
if (!endIndex->IsInteger()) {
std::ostringstream oss;
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, endIndex);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"toIndex\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -470,6 +475,7 @@ JSTaggedValue ContainersArrayList::ReplaceAllElements(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -528,6 +534,7 @@ JSTaggedValue ContainersArrayList::SubArrayList(EcmaRuntimeCallInfo *argv)
if (!value1->IsInteger()) {
std::ostringstream oss;
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value1);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"fromIndex\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -536,6 +543,7 @@ JSTaggedValue ContainersArrayList::SubArrayList(EcmaRuntimeCallInfo *argv)
if (!value2->IsInteger()) {
std::ostringstream oss;
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value2);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"toIndex\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -567,6 +575,7 @@ JSTaggedValue ContainersArrayList::Sort(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsUndefined() && !callbackFnHandle->IsCallable() && !callbackFnHandle->IsNull()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"comparator\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -677,6 +686,7 @@ JSTaggedValue ContainersArrayList::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -237,6 +237,7 @@ JSTaggedValue ContainersDeque::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -138,6 +138,7 @@ JSTaggedValue ContainersHashMap::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -218,6 +219,7 @@ JSTaggedValue ContainersHashMap::SetAll(EcmaRuntimeCallInfo *argv)
obj = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(obj)->GetTarget());
} else {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, obj);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"map\" must be HashMap. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -248,6 +248,7 @@ JSTaggedValue ContainersHashSet::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -103,6 +103,7 @@ JSTaggedValue ContainersLightWeightMap::HasAll(EcmaRuntimeCallInfo *argv)
lightWeightMap = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(lightWeightMap)->GetTarget());
} else {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, lightWeightMap.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"map\" must be LightWeightMap. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -180,6 +181,7 @@ JSTaggedValue ContainersLightWeightMap::IncreaseCapacityTo(EcmaRuntimeCallInfo *
if (!index->IsInt()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"minimumCapacity\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -317,6 +319,7 @@ JSTaggedValue ContainersLightWeightMap::GetKeyAt(EcmaRuntimeCallInfo *argv)
if (!index->IsInt()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -365,6 +368,7 @@ JSTaggedValue ContainersLightWeightMap::SetAll(EcmaRuntimeCallInfo *argv)
lightWeightMap = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(lightWeightMap)->GetTarget());
} else {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, lightWeightMap.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"map\" must be LightWeightMap. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -445,6 +449,7 @@ JSTaggedValue ContainersLightWeightMap::RemoveAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index(GetCallArg(argv, 0));
if (!index->IsInt()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -499,6 +504,7 @@ JSTaggedValue ContainersLightWeightMap::SetValueAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 1));
if (!index->IsInt()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -530,6 +536,7 @@ JSTaggedValue ContainersLightWeightMap::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> func(GetCallArg(argv, 0));
if (!func->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, func.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -606,6 +613,7 @@ JSTaggedValue ContainersLightWeightMap::GetValueAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index(GetCallArg(argv, 0));
if (!index->IsInt()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -96,6 +96,7 @@ JSTaggedValue ContainersLightWeightSet::AddAll(EcmaRuntimeCallInfo *argv)
value = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(value)->GetTarget());
} else {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"set\" must be LightWeightSet. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -145,6 +146,7 @@ JSTaggedValue ContainersLightWeightSet::GetValueAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 0));
if (!value->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -177,6 +179,7 @@ JSTaggedValue ContainersLightWeightSet::HasAll(EcmaRuntimeCallInfo *argv)
value = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(value)->GetTarget());
} else {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"set\" must be LightWeightSet. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -268,6 +271,7 @@ JSTaggedValue ContainersLightWeightSet::IncreaseCapacityTo(EcmaRuntimeCallInfo *
JSHandle<JSTaggedValue> value(GetCallArg(argv, 0));
if (!value->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"minimumCapacity\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -364,6 +368,7 @@ JSTaggedValue ContainersLightWeightSet::ForEach(EcmaRuntimeCallInfo *argv)
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -435,6 +440,7 @@ JSTaggedValue ContainersLightWeightSet::RemoveAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 0));
if (!value->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -178,6 +178,7 @@ JSTaggedValue ContainersLinkedList::Insert(EcmaRuntimeCallInfo *argv)
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -275,6 +276,7 @@ JSTaggedValue ContainersLinkedList::Get(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index = GetCallArg(argv, 0);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -344,6 +346,7 @@ JSTaggedValue ContainersLinkedList::RemoveByIndex(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index = GetCallArg(argv, 0);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -488,6 +491,7 @@ JSTaggedValue ContainersLinkedList::Set(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> element = GetCallArg(argv, 1);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -540,6 +544,7 @@ JSTaggedValue ContainersLinkedList::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle(GetCallArg(argv, 0));
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -94,6 +94,7 @@ JSTaggedValue ContainersList::Insert(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index = GetCallArg(argv, 1);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -206,6 +207,7 @@ JSTaggedValue ContainersList::Get(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index = GetCallArg(argv, 0);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -276,6 +278,7 @@ JSTaggedValue ContainersList::Set(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> element = GetCallArg(argv, 1);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -309,6 +312,7 @@ JSTaggedValue ContainersList::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle(GetCallArg(argv, 0));
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -379,6 +383,7 @@ JSTaggedValue ContainersList::RemoveByIndex(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index = GetCallArg(argv, 0);
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -429,6 +434,7 @@ JSTaggedValue ContainersList::ReplaceAllElements(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -486,6 +492,7 @@ JSTaggedValue ContainersList::Sort(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsUndefined() && !callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"comparator\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -545,6 +552,7 @@ JSTaggedValue ContainersList::GetSubList(EcmaRuntimeCallInfo *argv)
if (!fromIndex->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, fromIndex.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"fromIndex\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -555,6 +563,7 @@ JSTaggedValue ContainersList::GetSubList(EcmaRuntimeCallInfo *argv)
if (!toIndex->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, toIndex.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"toIndex\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -70,6 +70,7 @@ JSTaggedValue ContainersPlainArray::Add(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 1));
if (!key->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -140,6 +141,7 @@ JSTaggedValue ContainersPlainArray::Has(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 0));
if (!value->IsNumber()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -170,6 +172,7 @@ JSTaggedValue ContainersPlainArray::Get(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> key(GetCallArg(argv, 0));
if (!key->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -220,6 +223,7 @@ JSTaggedValue ContainersPlainArray::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -266,6 +270,7 @@ JSTaggedValue ContainersPlainArray::GetIndexOfKey(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 0));
if (!value->IsNumber()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -336,6 +341,7 @@ JSTaggedValue ContainersPlainArray::GetKeyAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 0));
if (!value->IsNumber()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -365,6 +371,7 @@ JSTaggedValue ContainersPlainArray::Remove(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> key(GetCallArg(argv, 0));
if (!key->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -393,6 +400,7 @@ JSTaggedValue ContainersPlainArray::RemoveAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> index(GetCallArg(argv, 0));
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -422,6 +430,7 @@ JSTaggedValue ContainersPlainArray::RemoveRangeFrom(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> valueSize(GetCallArg(argv, 1));
if (!valueIndex->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, valueIndex.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -429,6 +438,7 @@ JSTaggedValue ContainersPlainArray::RemoveRangeFrom(EcmaRuntimeCallInfo *argv)
}
if (!valueSize->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, valueSize.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"size\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -461,6 +471,7 @@ JSTaggedValue ContainersPlainArray::SetValueAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> value(GetCallArg(argv, 1));
if (!index->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, index.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -490,6 +501,7 @@ JSTaggedValue ContainersPlainArray::GetValueAt(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> idx(GetCallArg(argv, 0));
if (!idx->IsInteger()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, idx.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"index\" must be number. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -144,6 +144,7 @@ JSTaggedValue ContainersQueue::ForEach(EcmaRuntimeCallInfo *argv)
// If IsCallable(callbackfn) is false, throw a TypeError exception.
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -192,6 +192,7 @@ JSTaggedValue ContainersStack::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> callbackFnHandle = GetCallArg(argv, 0);
if (!callbackFnHandle->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, callbackFnHandle.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -58,6 +58,7 @@ JSTaggedValue ContainersTreeMap::TreeMapConstructor(EcmaRuntimeCallInfo *argv)
}
if (!compareFn->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, compareFn.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"comparefn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -252,6 +253,7 @@ JSTaggedValue ContainersTreeMap::SetAll(EcmaRuntimeCallInfo *argv)
obj = JSHandle<JSTaggedValue>(thread, JSHandle<JSProxy>::Cast(obj)->GetTarget());
} else {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, obj.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"map\" must be TreeMap. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -415,6 +417,7 @@ JSTaggedValue ContainersTreeMap::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> func(GetCallArg(argv, 0));
if (!func->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, func.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -57,6 +57,7 @@ JSTaggedValue ContainersTreeSet::TreeSetConstructor(EcmaRuntimeCallInfo *argv)
}
if (!compareFn->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, compareFn.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"comparefn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -223,6 +224,7 @@ JSTaggedValue ContainersTreeSet::GetLowerValue(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> key = GetCallArg(argv, 0);
if (!key->IsString() && !key->IsNumber()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be not null. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -253,6 +255,7 @@ JSTaggedValue ContainersTreeSet::GetHigherValue(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> key = GetCallArg(argv, 0);
if (!key->IsString() && !key->IsNumber()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be not null. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -365,6 +368,7 @@ JSTaggedValue ContainersTreeSet::ForEach(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> func(GetCallArg(argv, 0));
if (!func->IsCallable()) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, func.GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"callbackfn\" must be callable. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -77,10 +77,12 @@ public:
if (left.IsString()) {
JSHandle<EcmaString> stringA0 = JSHandle<EcmaString>(leftValue);
JSHandle<EcmaString> stringA1 = JSTaggedValue::ToString(thread, rightValue);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
EcmaString *ret = EcmaStringAccessor::Concat(thread->GetEcmaVM(), stringA0, stringA1);
return JSTaggedValue(ret);
} else {
JSHandle<EcmaString> stringA0 = JSTaggedValue::ToString(thread, leftValue);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<EcmaString> stringA1 = JSHandle<EcmaString>(rightValue);
EcmaString *ret = EcmaStringAccessor::Concat(thread->GetEcmaVM(), stringA0, stringA1);
return JSTaggedValue(ret);

View File

@ -405,6 +405,7 @@ bool JSAPIArrayList::GetOwnProperty(JSThread *thread, const JSHandle<JSAPIArrayL
uint32_t index = 0;
if (UNLIKELY(!JSTaggedValue::ToElementIndex(key.GetTaggedValue(), &index))) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
CString errorMsg =
"The type of \"index\" can not obtain attributes of no-number type. Received value is: "
+ ConvertToString(*result);

View File

@ -242,6 +242,7 @@ bool JSAPIDeque::GetOwnProperty(JSThread *thread, const JSHandle<JSAPIDeque> &de
uint32_t index = 0;
if (UNLIKELY(!JSTaggedValue::ToElementIndex(key.GetTaggedValue(), &index))) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
CString errorMsg =
"The type of \"key\" can not obtain attributes of no-number type. Received value is: "
+ ConvertToString(*result);

View File

@ -32,6 +32,7 @@ JSTaggedValue JSAPIHashSet::Has(JSThread *thread, JSTaggedValue value)
{
if (!TaggedHashArray::IsKey(value)) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"value\" must be Key of JS. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());
@ -80,6 +81,7 @@ JSTaggedValue JSAPIHashSet::Remove(JSThread *thread, JSHandle<JSAPIHashSet> hash
{
if (!TaggedHashArray::IsKey(key)) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be not null. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -234,6 +234,7 @@ bool JSAPILinkedList::GetOwnProperty(JSThread *thread, const JSHandle<JSAPILinke
uint32_t index = 0;
if (UNLIKELY(!JSTaggedValue::ToElementIndex(key.GetTaggedValue(), &index))) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
CString errorMsg =
"The type of \"index\" can not obtain attributes of no-number type. Received value is: "
+ ConvertToString(*result);

View File

@ -218,6 +218,7 @@ bool JSAPIList::GetOwnProperty(JSThread *thread, const JSHandle<JSAPIList> &list
uint32_t index = 0;
if (UNLIKELY(!JSTaggedValue::ToElementIndex(key.GetTaggedValue(), &index))) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
CString errorMsg =
"The type of \"index\" can not obtain attributes of no-number type. Received value is: "
+ ConvertToString(*result);

View File

@ -197,6 +197,7 @@ bool JSAPIQueue::GetOwnProperty(JSThread *thread, const JSHandle<JSAPIQueue> &ob
uint32_t index = 0;
if (UNLIKELY(!JSTaggedValue::ToElementIndex(key.GetTaggedValue(), &index))) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
CString errorMsg =
"The type of \"index\" can not obtain attributes of no-number type. Received value is: "
+ ConvertToString(*result);

View File

@ -142,6 +142,7 @@ bool JSAPIStack::GetOwnProperty(JSThread *thread, const JSHandle<JSAPIStack> &ob
uint32_t index = 0;
if (UNLIKELY(!JSTaggedValue::ToElementIndex(key.GetTaggedValue(), &index))) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
CString errorMsg =
"The type of \"index\" can not obtain attributes of no-number type. Received value is: "
+ ConvertToString(*result);

View File

@ -27,6 +27,7 @@ void JSAPITreeMap::Set(JSThread *thread, const JSHandle<JSAPITreeMap> &map, cons
{
if (!TaggedTreeMap::IsKey(key.GetTaggedValue())) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, key.GetTaggedValue());
RETURN_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"key\" must be not null. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -26,6 +26,7 @@ void JSAPITreeSet::Add(JSThread *thread, const JSHandle<JSAPITreeSet> &set, cons
{
if (!TaggedTreeSet::IsKey(value.GetTaggedValue())) {
JSHandle<EcmaString> result = JSTaggedValue::ToString(thread, value.GetTaggedValue());
RETURN_IF_ABRUPT_COMPLETION(thread);
CString errorMsg =
"The type of \"value\" must be Key of JS. Received value is: " + ConvertToString(*result);
JSTaggedValue error = ContainerError::BusinessError(thread, ErrorFlag::TYPE_ERROR, errorMsg.c_str());

View File

@ -45,6 +45,7 @@ JSHandle<JSTaggedValue> JSAsyncFromSyncIterator::CreateAsyncFromSyncIterator(JST
JSHandle<JSTaggedValue> nextStr = thread->GlobalConstants()->GetHandledNextString();
JSHandle<JSTaggedValue> tmpAsyncIterator(thread, asyncIterator.GetTaggedValue());
JSHandle<JSTaggedValue> nextMethod = JSTaggedValue::GetProperty(thread, tmpAsyncIterator, nextStr).GetValue();
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
// 4.Let iteratorRecord be the Record {[[Iterator]]: asyncIterator, [[NextMethod]]: nextMethod, [[Done]]: false}.
JSHandle<AsyncIteratorRecord> iteratorRecord = factory->NewAsyncIteratorRecord(tmpAsyncIterator, nextMethod, false);

View File

@ -100,10 +100,12 @@ void JSAsyncFunction::AsyncFunctionAwait(JSThread *thread, const JSHandle<JSTagg
JSHandle<JSTaggedValue> asyncCtxt;
if (asyncFuncObj->IsAsyncGeneratorObject()) {
JSHandle<JSObject> obj = JSTaggedValue::ToObject(thread, asyncFuncObj);
RETURN_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSAsyncGeneratorObject> asyncGen = JSHandle<JSAsyncGeneratorObject>::Cast(obj);
asyncCtxt = JSHandle<JSTaggedValue>(thread, asyncGen->GetGeneratorContext());
} else {
JSHandle<JSObject> obj = JSTaggedValue::ToObject(thread, asyncFuncObj);
RETURN_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSAsyncFuncObject> asyncFun = JSHandle<JSAsyncFuncObject>::Cast(obj);
asyncCtxt = JSHandle<JSTaggedValue>(thread, asyncFun->GetGeneratorContext());
}

View File

@ -45,6 +45,7 @@ void JSAsyncGeneratorObject::AsyncGeneratorValidate(JSThread *thread, const JSHa
}
// 4. If generator.[[GeneratorBrand]] is not the same value as generatorBrand, throw a TypeError exception.
JSHandle<JSObject> obj = JSTaggedValue::ToObject(thread, gen);
RETURN_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSAsyncGeneratorObject> generator = JSHandle<JSAsyncGeneratorObject>::Cast(obj);
if (!JSTaggedValue::SameValue(generator->GetGeneratorBrand(), val)) {
THROW_TYPE_ERROR(thread, "Results are not equal");
@ -271,6 +272,7 @@ JSTaggedValue JSAsyncGeneratorObject::AsyncGeneratorEnqueue(JSThread *thread, co
}
// 4. Let queue be generator.[[AsyncGeneratorQueue]].
JSHandle<JSObject> obj = JSTaggedValue::ToObject(thread, gen);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<JSAsyncGeneratorObject> generator = JSHandle<JSAsyncGeneratorObject>::Cast(obj);
JSHandle<TaggedQueue> queue(thread, generator->GetAsyncGeneratorQueue());
// 5. Let request be AsyncGeneratorRequest { [[Completion]]: completion, [[Capability]]: promiseCapability }.

View File

@ -238,6 +238,7 @@ bool JSFunction::MakeConstructor(JSThread *thread, const JSHandle<JSFunction> &f
PropertyDescriptor constructorDesc(thread, JSHandle<JSTaggedValue>::Cast(func), writable, false, true);
status = JSTaggedValue::DefinePropertyOrThrow(thread, proto, constructorKey, constructorDesc);
}
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
ASSERT_PRINT(status, "DefineProperty construct failed");
// func.prototype = proto

View File

@ -88,6 +88,7 @@ JSHandle<JSTaggedValue> JSIterator::GetAsyncIterator(JSThread *thread, const JSH
JSHandle<JSTaggedValue> syncIterator = GetIterator(thread, obj, func);
JSHandle<JSTaggedValue> nextStr = thread->GlobalConstants()->GetHandledNextString();
JSHandle<JSTaggedValue> nextMethod = JSTaggedValue::GetProperty(thread, syncIterator, nextStr).GetValue();
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
JSHandle<AsyncIteratorRecord> syncIteratorRecord =
factory->NewAsyncIteratorRecord(syncIterator, nextMethod, false);
JSHandle<JSTaggedValue> asyncIterator =
@ -206,6 +207,7 @@ JSHandle<JSTaggedValue> JSIterator::IteratorValue(JSThread *thread, const JSHand
// Return Get(iterResult, "value").
JSHandle<JSTaggedValue> valueStr = thread->GlobalConstants()->GetHandledValueString();
JSHandle<JSTaggedValue> value = JSTaggedValue::GetProperty(thread, iterResult, valueStr).GetValue();
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
return value;
}
// 7.4.5

View File

@ -647,6 +647,7 @@ JSHandle<JSObject> JSLocale::PutElement(JSThread *thread, int index, const JSHan
JSTaggedValue::SetProperty(thread, JSHandle<JSTaggedValue>::Cast(array), index,
JSHandle<JSTaggedValue>::Cast(record), true);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSObject, thread);
return record;
}

View File

@ -524,15 +524,19 @@ public:
// 6. Let mnfd be ? Get(options, "minimumFractionDigits").
JSHandle<JSTaggedValue> mnfdKey = globalConst->GetHandledMinimumFractionDigitsString();
JSHandle<JSTaggedValue> mnfd = JSTaggedValue::GetProperty(thread, options, mnfdKey).GetValue();
RETURN_IF_ABRUPT_COMPLETION(thread);
// 7. Let mxfd be ? Get(options, "maximumFractionDigits").
JSHandle<JSTaggedValue> mxfdKey = globalConst->GetHandledMaximumFractionDigitsString();
JSHandle<JSTaggedValue> mxfd = JSTaggedValue::GetProperty(thread, options, mxfdKey).GetValue();
RETURN_IF_ABRUPT_COMPLETION(thread);
// 8. Let mnsd be ? Get(options, "minimumSignificantDigits").
JSHandle<JSTaggedValue> mnsdKey = globalConst->GetHandledMinimumSignificantDigitsString();
JSHandle<JSTaggedValue> mnsd = JSTaggedValue::GetProperty(thread, options, mnsdKey).GetValue();
RETURN_IF_ABRUPT_COMPLETION(thread);
// 9. Let mxsd be ? Get(options, "maximumSignificantDigits").
JSHandle<JSTaggedValue> mxsdKey = globalConst->GetHandledMaximumSignificantDigitsString();
JSHandle<JSTaggedValue> mxsd = JSTaggedValue::GetProperty(thread, options, mxsdKey).GetValue();
RETURN_IF_ABRUPT_COMPLETION(thread);
// 10. Set intlObj.[[MinimumIntegerDigits]] to mnid.
intlObj->SetMinimumIntegerDigits(thread, JSTaggedValue(mnid));

View File

@ -533,6 +533,7 @@ JSHandle<TaggedArray> JSObject::GetEnumElementKeys(JSThread *thread, const JSHan
for (uint32_t i = static_cast<uint32_t>(offset); i < elementIndex; ++i) {
keyHandle.Update(JSTaggedValue(i));
auto key = JSTaggedValue::ToString(thread, keyHandle);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread);
elementArray->Set(thread, i, key);
}
}

View File

@ -42,6 +42,7 @@ JSHandle<JSPrimitiveRef> JSPrimitiveRef::StringCreate(JSThread *thread, const JS
// [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }).
PropertyDescriptor desc(thread, JSHandle<JSTaggedValue>(thread, JSTaggedValue(length)), false, false, false);
[[maybe_unused]] bool status = JSTaggedValue::DefinePropertyOrThrow(thread, str, lengthStr, desc);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSPrimitiveRef, thread);
ASSERT(status);
// 9. Return S.
return JSHandle<JSPrimitiveRef>(str);

View File

@ -124,6 +124,7 @@ JSTaggedValue JSStableArray::Splice(JSHandle<JSArray> receiver, EcmaRuntimeCallI
toKey.Update(JSTaggedValue(k));
if (newArrayHandle->IsJSProxy()) {
toKey.Update(JSTaggedValue::ToString(thread, toKey).GetTaggedValue());
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, toKey, fromValue);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -581,11 +582,13 @@ JSTaggedValue JSStableArray::Reverse(JSThread *thread, JSHandle<JSObject> thisOb
} else if (upperExists) {
array->Set(thread, lower, upperValueHandle.GetTaggedValue());
JSTaggedValue::SetProperty(thread, thisObjVal, lowerP, upperValueHandle, true);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, upperP);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
} else if (lowerExists) {
array->Set(thread, upper, lowerValueHandle.GetTaggedValue());
JSTaggedValue::SetProperty(thread, thisObjVal, upperP, lowerValueHandle, true);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSTaggedValue::DeletePropertyOrThrow(thread, thisObjVal, lowerP);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}

View File

@ -387,6 +387,7 @@ JSTaggedValue JSTaggedValue::OrdinaryToPrimitive(JSThread *thread, const JSHandl
keyString = globalConst->GetHandledValueOfString();
}
JSHandle<JSTaggedValue> entryfunc = GetProperty(thread, tagged, keyString).GetValue();
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception());
if (entryfunc->IsCallable()) {
JSHandle<JSTaggedValue> undefined = globalConst->GetHandledUndefined();
EcmaRuntimeCallInfo *info =

View File

@ -120,6 +120,7 @@ bool JSTypedArray::HasProperty(JSThread *thread, const JSHandle<JSTaggedValue> &
return true;
}
JSTaggedValue parent = JSTaggedValue::GetPrototype(thread, JSHandle<JSTaggedValue>::Cast(typedarrayObj));
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false);
if (!parent.IsNull()) {
return JSTaggedValue::HasProperty(thread, JSHandle<JSTaggedValue>(thread, parent), key);
}
@ -293,6 +294,7 @@ JSHandle<TaggedArray> JSTypedArray::OwnPropertyKeys(JSThread *thread, const JSHa
for (uint32_t k = 0; k < bufferKeysLen; k++) {
tKey.Update(JSTaggedValue(k));
JSHandle<JSTaggedValue> sKey(JSTaggedValue::ToString(thread, tKey));
RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread);
nameList->Set(thread, copyLength, sKey.GetTaggedValue());
copyLength++;
}

View File

@ -407,7 +407,7 @@ JSHandle<JSFunction> ClassHelper::DefineClassFromExtractor(JSThread *thread, con
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle<JSTaggedValue>(prototype),
globalConst->GetHandledConstructorString(), ctorDesc);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSFunction, thread);
constructor->SetHomeObject(thread, prototype);
constructor->SetProtoOrHClass(thread, prototype);
@ -547,7 +547,7 @@ JSHandle<JSFunction> ClassHelper::DefineClassWithConstructorHClass(JSThread *thr
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle<JSTaggedValue>(prototype),
globalConst->GetHandledConstructorString(), ctorDesc);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSFunction, thread);
constructor->SetHomeObject(thread, prototype);
constructor->SetProtoOrHClass(thread, ihclass);

View File

@ -1696,6 +1696,7 @@ JSHandle<JSIntlBoundFunction> ObjectFactory::NewJSIntlBoundFunction(MethodIndex
JSHandle<JSTaggedValue> nameKey = globalConst->GetHandledNameString();
PropertyDescriptor nameDesc(thread_, emptyString, false, false, true);
JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle<JSTaggedValue>::Cast(function), nameKey, nameDesc);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSIntlBoundFunction, thread_);
return intlBoundFunc;
}
@ -1716,6 +1717,7 @@ JSHandle<JSProxyRevocFunction> ObjectFactory::NewJSProxyRevocFunction(const JSHa
JSHandle<JSTaggedValue> nameKey = globalConst->GetHandledNameString();
PropertyDescriptor nameDesc(thread_, emptyString, false, false, true);
JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle<JSTaggedValue>::Cast(function), nameKey, nameDesc);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSProxyRevocFunction, thread_);
return revocFunction;
}
@ -1810,6 +1812,7 @@ JSHandle<JSPrimitiveRef> ObjectFactory::NewJSPrimitiveRef(const JSHandle<JSFunct
uint32_t length = EcmaStringAccessor(object.GetTaggedValue()).GetLength();
PropertyDescriptor desc(thread_, JSHandle<JSTaggedValue>(thread_, JSTaggedValue(length)), false, false, false);
JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle<JSTaggedValue>(obj), lengthStr, desc);
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSPrimitiveRef, thread_);
}
return obj;

View File

@ -259,6 +259,7 @@ void ObjectOperator::GlobalLookupProperty()
return;
}
JSTaggedValue proto = JSTaggedValue::GetPrototype(thread_, holder_);
RETURN_IF_ABRUPT_COMPLETION(thread_);
if (!proto.IsHeapObject()) {
return;
}
@ -280,6 +281,7 @@ void ObjectOperator::LookupProperty()
}
JSTaggedValue proto = JSTaggedValue::GetPrototype(thread_, holder_);
RETURN_IF_ABRUPT_COMPLETION(thread_);
if (!proto.IsHeapObject()) {
return;
}

View File

@ -105,6 +105,7 @@ void PGOProfiler::ProfileDefineClass(JSThread *thread, JSTaggedType func, int32_
auto currentType = PGOSampleType::CreateClassType(ctorMethodId);
auto superFuncValue = JSTaggedValue::GetPrototype(thread, ctorValue);
RETURN_IF_ABRUPT_COMPLETION(thread);
PGOSampleType superType = PGOSampleType::CreateClassType(0);
if (superFuncValue.IsJSFunction()) {
auto superFuncFunction = JSFunction::Cast(superFuncValue);

View File

@ -236,6 +236,7 @@ JSTaggedValue RuntimeStubs::RuntimeSuperCallSpread(JSThread *thread, const JSHan
const JSHandle<JSTaggedValue> &array)
{
JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
ASSERT(superFunc->IsJSFunction());
JSHandle<TaggedArray> argv(thread, RuntimeGetCallSpreadArgs(thread, array));
@ -275,6 +276,7 @@ JSTaggedValue RuntimeStubs::RuntimeNewObjApply(JSThread *thread, const JSHandle<
JSHandle<TaggedArray> argsArray = factory->NewTaggedArray(length);
for (uint32_t i = 0; i < length; ++i) {
auto prop = JSTaggedValue::GetProperty(thread, array, i).GetValue();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
argsArray->Set(thread, i, prop);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
}
@ -383,6 +385,7 @@ JSTaggedValue RuntimeStubs::RuntimeCopyDataProperties(JSThread *thread, const JS
if (!src->IsNull() && !src->IsUndefined()) {
// 2. Let from be ! ToObject(source).
JSHandle<JSTaggedValue> from(JSTaggedValue::ToObject(thread, src));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<TaggedArray> keys = JSTaggedValue::GetOwnPropertyKeys(thread, from);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -452,6 +455,7 @@ JSTaggedValue RuntimeStubs::RuntimeStArraySpread(JSThread *thread, const JSHandl
bool success = JSTaggedValue::GetOwnProperty(thread, iterResult, valueStr, desc);
if (success && desc.IsEnumerable()) {
JSTaggedValue::DefineOwnProperty(thread, dst, indexHandle, desc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
int tmp = indexHandle->GetInt();
indexHandle.Update(JSTaggedValue(tmp + 1));
}
@ -546,6 +550,7 @@ JSTaggedValue RuntimeStubs::RuntimeStOwnByValue(JSThread *thread, const JSHandle
JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, key);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, propKey, desc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!ret) {
return RuntimeThrowTypeError(thread, "StOwnByValue failed");
}
@ -652,6 +657,7 @@ JSTaggedValue RuntimeStubs::RuntimeStOwnByIndex(JSThread *thread, const JSHandle
PropertyDescriptor desc(thread, value, true, enumerable, true);
bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, idx, desc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!ret) {
return RuntimeThrowTypeError(thread, "SetOwnByIndex failed");
}
@ -904,6 +910,7 @@ JSTaggedValue RuntimeStubs::RuntimeSetClassInheritanceRelationship(JSThread *thr
method->SetFunctionKind(FunctionKind::DERIVED_CONSTRUCTOR);
parentPrototype = JSTaggedValue::GetProperty(thread, parent,
globalConst->GetHandledPrototypeString()).GetValue();
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!parentPrototype->IsECMAObject() && !parentPrototype->IsNull()) {
return RuntimeThrowTypeError(thread, "parent class have no valid prototype");
}
@ -980,6 +987,7 @@ JSTaggedValue RuntimeStubs::RuntimeStOwnByValueWithNameSet(JSThread *thread, con
JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, key);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, propKey, desc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!ret) {
return RuntimeThrowTypeError(thread, "StOwnByValueWithNameSet failed");
}
@ -1004,6 +1012,7 @@ JSTaggedValue RuntimeStubs::RuntimeStOwnByName(JSThread *thread, const JSHandle<
PropertyDescriptor desc(thread, value, true, enumerable, true);
bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, prop, desc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!ret) {
return RuntimeThrowTypeError(thread, "SetOwnByName failed");
}
@ -1023,6 +1032,7 @@ JSTaggedValue RuntimeStubs::RuntimeStOwnByNameWithNameSet(JSThread *thread,
PropertyDescriptor desc(thread, valueHandle, true, enumerable, true);
bool ret = JSTaggedValue::DefineOwnProperty(thread, objHandle, propHandle, desc);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!ret) {
return RuntimeThrowTypeError(thread, "SetOwnByNameWithNameSet failed");
}
@ -1301,6 +1311,7 @@ JSTaggedValue RuntimeStubs::RuntimeTryLdGlobalByName(JSThread *thread, const JSH
const JSHandle<JSTaggedValue> &prop)
{
OperationResult res = JSTaggedValue::GetProperty(thread, obj, prop);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
if (!res.GetPropertyMetaData().IsFound()) {
return RuntimeThrowReferenceError(thread, prop, " is not defined");
}
@ -1921,7 +1932,7 @@ JSTaggedValue RuntimeStubs::CommonCreateObjectWithExcludedKeys(JSThread *thread,
return restObj.GetTaggedValue();
}
JSHandle<JSObject> obj(JSTaggedValue::ToObject(thread, objVal));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<TaggedArray> allKeys = JSObject::GetOwnPropertyKeys(thread, obj);
uint32_t numAllKeys = allKeys->GetLength();
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
@ -2074,6 +2085,7 @@ JSTaggedValue RuntimeStubs::RuntimeSuperCall(JSThread *thread, const JSHandle<JS
uint16_t length)
{
JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
ASSERT(superFunc->IsJSFunction());
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
@ -2099,6 +2111,7 @@ JSTaggedValue RuntimeStubs::RuntimeOptSuperCall(JSThread *thread, uintptr_t argv
JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);
JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1);
JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
ASSERT(superFunc->IsJSFunction());
uint16_t length = argc - fixNums;
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();