diff --git a/BUILD.gn b/BUILD.gn index 61a21036beacc6ec0e0b6a853ff1d7bb89fd8d53..042bdd5acfe84236ddf5532cfe8110fccf5a6e5e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -436,7 +436,7 @@ source_set("libark_jsruntime_test_static") { sources += intl_sources deps = [ - ":copy_resource_xml", + ":copy_ark_resource", "$ark_root/libpandabase:libarkbase", "$ark_root/libpandafile:libarkfile", "$ark_root/runtime:arkruntime_header_deps", @@ -478,25 +478,28 @@ ohos_shared_library("libark_jsruntime_test") { subsystem_name = "test" } -action("copy_resource_xml") { +action("copy_ark_resource") { deps = [] script = "//ark/js_runtime/test/copy_resource.py" - src_path = "//ark/js_runtime/test/resource/js_runtime/" + src_path = "//ark/js_runtime/test/resource/js_runtime" src_xml = "ohos_test.xml" dst_path = "//ark/test/resource/js_runtime/" args = [ "--src-path", - rebase_path(src_path), + rebase_path("${src_path}/"), "--src-xml", src_xml, "--dst-path", rebase_path(dst_path), ] - inputs = [ src_path + src_xml ] + inputs = [ + src_path, + "${src_path}/${src_xml}", + ] outputs = [ "$target_out_dir" ] } diff --git a/ecmascript/builtins/builtins_promise.cpp b/ecmascript/builtins/builtins_promise.cpp index 663bd1df9aec5706bb2797494c8853f08f070413..5cdd765d6807ef3b36f28480806671754c84f94c 100644 --- a/ecmascript/builtins/builtins_promise.cpp +++ b/ecmascript/builtins/builtins_promise.cpp @@ -399,14 +399,13 @@ JSTaggedValue BuiltinsPromise::PerformPromiseThen(JSThread *thread, const JSHand if (JSTaggedValue::SameValue(promise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING)))) { JSHandle fulfillReactions(thread, promise->GetPromiseFulfillReactions()); - auto result = - JSTaggedValue(TaggedQueue::Push(thread, fulfillReactions, JSHandle::Cast(fulfillReaction))); - promise->SetPromiseFulfillReactions(thread, result); + TaggedQueue *newQueue = + TaggedQueue::Push(thread, fulfillReactions, JSHandle::Cast(fulfillReaction)); + promise->SetPromiseFulfillReactions(thread, JSTaggedValue(newQueue)); JSHandle rejectReactions(thread, promise->GetPromiseRejectReactions()); - result = - JSTaggedValue(TaggedQueue::Push(thread, rejectReactions, JSHandle::Cast(rejectReaction))); - promise->SetPromiseRejectReactions(thread, result); + newQueue = TaggedQueue::Push(thread, rejectReactions, JSHandle::Cast(rejectReaction)); + promise->SetPromiseRejectReactions(thread, JSTaggedValue(newQueue)); } else if (JSTaggedValue::SameValue(promise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::FULFILLED)))) { JSHandle argv = factory->NewTaggedArray(2); // 2: 2 means two args stored in array diff --git a/ecmascript/ecma_module.cpp b/ecmascript/ecma_module.cpp index cebd2c0aeaca4139560260ccff7d315f08b4e902..edeaadc50eead693d4f0fc7e83ddc4f94bbbcb2d 100644 --- a/ecmascript/ecma_module.cpp +++ b/ecmascript/ecma_module.cpp @@ -61,7 +61,7 @@ void EcmaModule::RemoveItem(const JSThread *thread, JSHandle module, JSHandle moduleItems(data); int entry = moduleItems->FindEntry(itemName.GetTaggedValue()); if (entry != -1) { - NameDictionary *newDict = NameDictionary::Remove(thread, moduleItems, entry); // discard return + NameDictionary *newDict = NameDictionary::Remove(thread, moduleItems, entry); module->SetNameDictionary(thread, JSTaggedValue(newDict)); } } diff --git a/ecmascript/interpreter/fast_runtime_stub-inl.h b/ecmascript/interpreter/fast_runtime_stub-inl.h index 7d2faab112708e98d87c858edc1db01ad53de2e8..055ba3b9129037de5a0d58fbeea27d025cc8a199 100644 --- a/ecmascript/interpreter/fast_runtime_stub-inl.h +++ b/ecmascript/interpreter/fast_runtime_stub-inl.h @@ -880,9 +880,9 @@ bool FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue receiver if (receiver.IsJSGlobalObject()) { [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle dict_handle(thread, properties); + JSHandle dictHandle(thread, properties); // globalobj have no internal accessor - GlobalDictionary::InvalidatePropertyBox(thread, dict_handle, indexOrEntry, attr); + GlobalDictionary::InvalidatePropertyBox(thread, dictHandle, indexOrEntry, attr); return true; } @@ -961,7 +961,7 @@ bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue recei JSHandle keyHandle(thread, key); JSHandle valHandle(thread, value); JSHandle objHandle(thread, obj); - JSHandle dict_handle(thread, GlobalDictionary::Create(thread)); + JSHandle dictHandle(thread, GlobalDictionary::Create(thread)); // Add PropertyBox to global dictionary ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); @@ -971,7 +971,7 @@ bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue recei attr.SetBoxType(boxType); GlobalDictionary *properties = - GlobalDictionary::PutIfAbsent(thread, dict_handle, keyHandle, JSHandle(boxHandle), attr); + GlobalDictionary::PutIfAbsent(thread, dictHandle, keyHandle, JSHandle(boxHandle), attr); objHandle->SetProperties(thread, JSTaggedValue(properties)); return true; } @@ -983,8 +983,8 @@ bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue recei if (!attr.IsAccessor()) { if (attr.IsWritable()) { // globalobj have no internal accessor - JSHandle dict_handle(thread, dict); - GlobalDictionary::InvalidatePropertyBox(thread, dict_handle, entry, attr); + JSHandle dictHandle(thread, dict); + GlobalDictionary::InvalidatePropertyBox(thread, dictHandle, entry, attr); return true; } } @@ -1011,7 +1011,7 @@ bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue recei JSHandle keyHandle(thread, key); JSHandle valHandle(thread, value); JSHandle objHandle(thread, obj); - JSHandle dict_handle(thread, dict); + JSHandle dictHandle(thread, dict); // Add PropertyBox to global dictionary ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); @@ -1021,7 +1021,7 @@ bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue recei attr.SetBoxType(boxType); GlobalDictionary *properties = - GlobalDictionary::PutIfAbsent(thread, dict_handle, keyHandle, JSHandle(boxHandle), attr); + GlobalDictionary::PutIfAbsent(thread, dictHandle, keyHandle, JSHandle(boxHandle), attr); objHandle->SetProperties(thread, JSTaggedValue(properties)); return true; } diff --git a/test/copy_resource.py b/test/copy_resource.py index b6b3a10cd18d1b2c669cb36a867bc7b16d0e2755..dfaa369555be9dbca4e80ed15f5e9f86a2e7f697 100755 --- a/test/copy_resource.py +++ b/test/copy_resource.py @@ -35,21 +35,20 @@ def parse_args(): return args -def copy_xml(args): - """copy resource xml to test direction.""" +def copy_res(args): + """copy resources to test direction.""" src_xml_file = os.path.join(args.src_path, args.src_xml) - dst_xml_file = os.path.join(args.dst_path, args.src_xml) if not os.path.isfile(src_xml_file): print(args.src_xml + " not exist.") return - if not os.path.exists(args.dst_path): - os.makedirs(args.dst_path) + if os.path.exists(args.dst_path): + shutil.rmtree(args.dst_path) - shutil.copyfile(src_xml_file, dst_xml_file) + shutil.copytree(args.src_path, args.dst_path) if __name__ == '__main__': input_args = parse_args() - copy_xml(input_args) + copy_res(input_args)