mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
Fixbug src is undefined in runtime_stubs-inl.h:415: RuntimeStArraySpread
modify the assert function call in runtime_stubs-inl.h:415: RuntimeStArraySpread delete the judge 'src->IsUndefined() && src->IsNull()' in calling assert add an if statement to handle the case of src is Undefine and src is Null issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I82YU2?from=project-issue Signed-off-by: hecunmao <hecunmao@huawei.com> Change-Id: I49c4be25d62fa97e3c4d8a2ae0b3adf621d2aa64
This commit is contained in:
parent
059023f77a
commit
f98d685ad5
@ -412,7 +412,14 @@ JSTaggedValue RuntimeStubs::RuntimeStArraySpread(JSThread *thread, const JSHandl
|
||||
JSTaggedValue index, const JSHandle<JSTaggedValue> &src)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
ASSERT(dst->IsJSArray() && !src->IsNull() && !src->IsUndefined());
|
||||
ASSERT(dst->IsJSArray());
|
||||
if (dst->IsJSArray()) {
|
||||
if (src->IsNull() || src->IsUndefined()) {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, "src is not iterable", JSTaggedValue::Exception());
|
||||
}
|
||||
} else {
|
||||
THROW_TYPE_ERROR_AND_RETURN(thread, "dst is not iterable", JSTaggedValue::Exception());
|
||||
}
|
||||
if (src->IsString()) {
|
||||
JSHandle<EcmaString> srcString = JSTaggedValue::ToString(thread, src);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
@ -39,3 +39,4 @@ Apple Banana
|
||||
2
|
||||
3
|
||||
4
|
||||
true
|
||||
|
@ -127,4 +127,13 @@ for (let i = 0; i < 5; ++i) {
|
||||
}
|
||||
for (let i = 0; i < 5; ++i) {
|
||||
print(app.childNodes[i].childNodes[0].childNodes[0].content);
|
||||
}
|
||||
}
|
||||
let result = []
|
||||
try {
|
||||
class C29 {};
|
||||
const v66 = undefined;
|
||||
new C29(...v66);
|
||||
} catch (err) {
|
||||
result.push(err.name == "TypeError");
|
||||
}
|
||||
print(result)
|
Loading…
Reference in New Issue
Block a user