diff --git a/static_core/plugins/ets/runtime/ets_panda_file_items.h b/static_core/plugins/ets/runtime/ets_panda_file_items.h index abbda9808ceebede77aa42331eff52d3d7e4aeff..707c6026c298031bc580aaa096ecf2401533174e 100644 --- a/static_core/plugins/ets/runtime/ets_panda_file_items.h +++ b/static_core/plugins/ets/runtime/ets_panda_file_items.h @@ -229,7 +229,7 @@ static constexpr std::string_view INTERFACE_OBJ_LITERAL = "Lstd/a // escompat static constexpr std::string_view DATE = "Lescompat/Date;"; static constexpr std::string_view ARRAY_ENTRIES_ITERATOR_T = "Lescompat/ArrayEntriesIterator_T;"; -static constexpr std::string_view ITERATOR_RESULT = "Lescompat/IteratorResult;"; +static constexpr std::string_view ITERATOR_RESULT = "Lstd/core/IteratorResult;"; static constexpr std::string_view ARRAY_KEYS_ITERATOR = "Lescompat/ArrayKeysIterator;"; static constexpr std::string_view ARRAY_VALUES_ITERATOR_T = "Lescompat/ArrayValuesIterator_T;"; static constexpr std::string_view MAP = "Lescompat/Map;"; diff --git a/static_core/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h b/static_core/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h index 4dce0434119e7eacc67293c92a399abf05cbe5d1..887eea9a084a3a5b43e40efcbfed21e38ad8b2ee 100644 --- a/static_core/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h +++ b/static_core/plugins/ets/runtime/interop_js/ets_proxy/ets_class_wrapper.h @@ -184,7 +184,7 @@ private: napi_ref jsProxyCtorRef_ {}; napi_ref jsProxyHandlerRef_ {}; - static constexpr const char *INTERFACE_ITERABLE_NAME = "escompat.IterableIterator"; + static constexpr const char *INTERFACE_ITERABLE_NAME = "std.core.IterableIterator"; }; class JSRefConvertJSProxy : public JSRefConvert { diff --git a/static_core/plugins/ets/runtime/interop_js/js_refconvert_builtin.cpp b/static_core/plugins/ets/runtime/interop_js/js_refconvert_builtin.cpp index 4bffa875531272cc583d60b38865f20216d9637d..158b49e204bc5d7e76d0cd6b2c0234dd6a1d63cd 100644 --- a/static_core/plugins/ets/runtime/interop_js/js_refconvert_builtin.cpp +++ b/static_core/plugins/ets/runtime/interop_js/js_refconvert_builtin.cpp @@ -253,7 +253,7 @@ private: { static const ets_proxy::EtsClassWrapper::OverloadsMap W_MAP_OVERLOADS = { {utf::CStringAsMutf8(""), - {"{ULescompat/Iterable;Lescompat/ReadonlyArray;Lstd/core/Null;}:V", 2, ""}}}; + {"{ULstd/core/Iterable;Lescompat/ReadonlyArray;Lstd/core/Null;}:V", 2, ""}}}; wMap_ = RegisterClassWithLeafMatcher(descriptors::MAP, "Map", &W_MAP_OVERLOADS); } @@ -261,7 +261,7 @@ private: { static const ets_proxy::EtsClassWrapper::OverloadsMap W_SET_OVERLOADS = { {utf::CStringAsMutf8(""), - {"{ULescompat/Iterable;Lstd/core/Null;[Lstd/core/Object;}:V", 2, ""}}}; + {"{ULstd/core/Iterable;Lstd/core/Null;[Lstd/core/Object;}:V", 2, ""}}}; wSet_ = RegisterClassWithLeafMatcher(descriptors::SET, "Set", &W_SET_OVERLOADS); } diff --git a/static_core/plugins/ets/stdlib/escompat/Array.ets b/static_core/plugins/ets/stdlib/escompat/Array.ets index 75e87d56f45604de407420204858e10b28a78cc7..311e3115fb1d6afa11fe2f9c09b0e3e85b3c418f 100644 --- a/static_core/plugins/ets/stdlib/escompat/Array.ets +++ b/static_core/plugins/ets/stdlib/escompat/Array.ets @@ -14,6 +14,7 @@ */ package escompat; +import {iteratorForEach} from "std/core" // NOTE: autogenerated file diff --git a/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets b/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets index 1d7a7f47d62545be0403852c31cdacbcca88e022..c6c6fd9b7a1cece6e348e3ebd5be8c7ceab0334e 100644 --- a/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets +++ b/static_core/plugins/ets/stdlib/escompat/TypedArrays.ets @@ -16,6 +16,7 @@ // Autogenerated file. DO NOT EDIT package escompat +import {iteratorForEach, tryGetIteratorLength} from "std/core" class Int8ArrayIteratorKeys implements IterableIterator { private length: int diff --git a/static_core/plugins/ets/stdlib/escompat/Iterator.ets b/static_core/plugins/ets/stdlib/std/core/Iterator.ets similarity index 91% rename from static_core/plugins/ets/stdlib/escompat/Iterator.ets rename to static_core/plugins/ets/stdlib/std/core/Iterator.ets index 5f13bdab6e4c108d68ff33d424d35763706e6696..4a69297a47255035863cbbea24a24707383553bf 100644 --- a/static_core/plugins/ets/stdlib/escompat/Iterator.ets +++ b/static_core/plugins/ets/stdlib/std/core/Iterator.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -package escompat; +package std.core; export class IteratorResult { done: boolean @@ -49,7 +49,7 @@ export interface IterableIterator extends Iterator, Iterable { } } -function iteratorForEach(x: Iterator, fn: (x: V) => void): void { +export function iteratorForEach(x: Iterator, fn: (x: V) => void): void { while (true) { const v = x.next() if (v.done) { @@ -59,7 +59,7 @@ function iteratorForEach(x: Iterator, fn: (x: V) => void): void { } } -function tryGetIteratorLength (a: Object): int | null { +export function tryGetIteratorLength (a: Object): int | null { const aType = Type.of(a) as ClassType for (let i = 0; i < aType.getMethodsNum(); ++i) { let m = aType.getMethod(i) diff --git a/static_core/plugins/ets/templates/stdlib/Array_escompat.erb b/static_core/plugins/ets/templates/stdlib/Array_escompat.erb index 2afd21bed82ef2c7660b77041dc9d7562e20550c..b0900db494cf4282303ff9dd19123ee6151fdace 100644 --- a/static_core/plugins/ets/templates/stdlib/Array_escompat.erb +++ b/static_core/plugins/ets/templates/stdlib/Array_escompat.erb @@ -14,6 +14,7 @@ */ package escompat; +import {iteratorForEach} from "std/core" // NOTE: autogenerated file diff --git a/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 b/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 index 5ac995d860ebb370130dee0991423668f3b27e0a..02819eb7c5b3956f3c87319d8f9cf567dffbc3c1 100644 --- a/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 +++ b/static_core/plugins/ets/templates/stdlib/typedArray.ets.j2 @@ -16,6 +16,7 @@ // Autogenerated file. DO NOT EDIT package escompat +import {iteratorForEach, tryGetIteratorLength} from "std/core" {%- for N, U, T, BT, S in [ ('Int8', 'Uint8', 'byte', 'Byte', 1), diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/IteratorArrayTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/IteratorArrayTest.ets similarity index 100% rename from static_core/plugins/ets/tests/ets_func_tests/escompat/IteratorArrayTest.ets rename to static_core/plugins/ets/tests/ets_func_tests/std/core/IteratorArrayTest.ets diff --git a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt index 785881df02a0a4c9475996a681534649411451c2..2f7f80e5b5febe8a0a7aa400d3048cc3c50a9e60 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-func-tests/ets-func-tests-excluded.txt @@ -26,7 +26,7 @@ escompat/JsonStringifyTest.ets # extended escompat/ArrayProxyTest.ets escompat/ArrayTest7.ets -escompat/IteratorArrayTest.ets +std/core/IteratorArrayTest.ets escompat/escompat_Array_modifications_Test_escompat_Array_modifications.ets escompat/escompat_Array_modifications_Test_escompat_Array_modifications_001.ets escompat/escompat_Array_modifications_Test_escompat_Array_modifications_002.ets