mirror of
https://github.com/openharmony/ark_js_runtime.git
synced 2026-08-27 02:31:17 -04:00
Add Containers List And LinkedList
Description
1.To ensure the high performance of container classes, List and LinkedList is provided in ark.
2.modify Copyright 2021->2022.
3.fix containers.
Related issue
#I58XA9:Add Containers List And LinkedList.
Signed-off-by: chenqi <chenqi151@huawei.com>
This commit is contained in:
@@ -154,15 +154,17 @@ JSTaggedValue JSAPIPlainArray::Set(JSThread *thread, const JSHandle<JSAPIPlainAr
|
||||
}
|
||||
|
||||
bool JSAPIPlainArray::GetOwnProperty(JSThread *thread, const JSHandle<JSAPIPlainArray> &obj,
|
||||
const JSHandle<JSTaggedValue> &key, PropertyDescriptor &desc)
|
||||
const JSHandle<JSTaggedValue> &key)
|
||||
{
|
||||
TaggedArray *keyArray = TaggedArray::Cast(obj->GetKeys().GetTaggedObject());
|
||||
int32_t size = obj->GetLength();
|
||||
int32_t index = obj->BinarySearch(keyArray, 0, size, key.GetTaggedValue().GetNumber());
|
||||
if (index < 0 || index > size) {
|
||||
int32_t index = obj->BinarySearch(keyArray, 0, size, key.GetTaggedValue().GetInt());
|
||||
if (index < 0 || index >= size) {
|
||||
THROW_RANGE_ERROR_AND_RETURN(thread, "GetOwnProperty index out-of-bounds", false);
|
||||
}
|
||||
return JSObject::GetOwnProperty(thread, JSHandle<JSObject>::Cast(obj), key, desc);
|
||||
|
||||
obj->Get(key.GetTaggedValue());
|
||||
return true;
|
||||
}
|
||||
|
||||
OperationResult JSAPIPlainArray::GetProperty(JSThread *thread, const JSHandle<JSAPIPlainArray> &obj,
|
||||
@@ -170,8 +172,8 @@ OperationResult JSAPIPlainArray::GetProperty(JSThread *thread, const JSHandle<JS
|
||||
{
|
||||
TaggedArray *keyArray = TaggedArray::Cast(obj->GetKeys().GetTaggedObject());
|
||||
int32_t size = obj->GetLength();
|
||||
int32_t index = obj->BinarySearch(keyArray, 0, size, key.GetTaggedValue().GetNumber());
|
||||
if (index < 0 || index > size) {
|
||||
int32_t index = obj->BinarySearch(keyArray, 0, size, key.GetTaggedValue().GetInt());
|
||||
if (index < 0 || index >= size) {
|
||||
THROW_RANGE_ERROR_AND_RETURN(thread, "GetProperty index out-of-bounds",
|
||||
OperationResult(thread, JSTaggedValue::Exception(), PropertyMetaData(false)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user