From e14819879c0c1f58d1365f53025c28683f946037 Mon Sep 17 00:00:00 2001 From: Steven Cole Date: Tue, 2 Sep 2025 18:46:36 -0700 Subject: [PATCH] change all the `pub` to `pub(crate)` This gives me much better dead-code warnings, and so a lot of stuff got cleaned up, along with a lot of other newish lints. --- Cargo.lock | 480 +++--- src/agent/mod.rs | 574 +++---- src/agent/tests.rs | 74 +- src/arguments_object/mod.rs | 22 +- src/arrays/mod.rs | 35 +- src/bigint_object.rs | 14 +- src/boolean_object/mod.rs | 12 +- src/bound_function.rs | 12 +- src/chunk/mod.rs | 79 +- src/comparison/mod.rs | 8 +- src/compiler/mod.rs | 511 ++++-- src/control_abstraction/mod.rs | 140 +- src/control_abstraction/tests.rs | 34 +- src/cr/mod.rs | 12 +- src/date_object.rs | 14 +- src/dtoa_r.rs | 16 +- src/environment_record/mod.rs | 74 +- src/errors/mod.rs | 58 +- src/execution_context/mod.rs | 65 +- src/execution_context/tests.rs | 2 +- src/function_object/mod.rs | 270 ++-- src/function_object/tests.rs | 40 +- src/main.rs | 74 +- src/map.rs | 10 +- src/math.rs | 2 +- src/number_object/mod.rs | 14 +- src/object/mod.rs | 332 ++-- src/object/objtests.rs | 19 - src/object_object/mod.rs | 4 +- src/parser/additive_operators/mod.rs | 52 +- src/parser/additive_operators/tests.rs | 16 +- src/parser/arrow_function_definitions/mod.rs | 217 ++- src/parser/assignment_operators/mod.rs | 430 ++--- src/parser/assignment_operators/tests.rs | 159 +- .../async_arrow_function_definitions/mod.rs | 312 ++-- .../async_arrow_function_definitions/tests.rs | 35 - src/parser/async_function_definitions/mod.rs | 174 +- .../async_function_definitions/tests.rs | 43 - .../mod.rs | 166 +- .../tests.rs | 47 - src/parser/binary_bitwise_operators/mod.rs | 141 +- src/parser/binary_bitwise_operators/tests.rs | 45 +- src/parser/binary_logical_operators/mod.rs | 182 +-- src/parser/binary_logical_operators/tests.rs | 39 +- src/parser/bitwise_shift_operators/mod.rs | 52 +- src/parser/bitwise_shift_operators/tests.rs | 17 +- src/parser/block/mod.rs | 190 ++- src/parser/break_statement/mod.rs | 30 +- src/parser/break_statement/tests.rs | 10 - src/parser/class_definitions/mod.rs | 393 ++--- src/parser/class_definitions/tests.rs | 12 - src/parser/comma_operator/mod.rs | 52 +- src/parser/comma_operator/tests.rs | 15 +- src/parser/conditional_operator/mod.rs | 49 +- src/parser/conditional_operator/tests.rs | 14 +- src/parser/continue_statement/mod.rs | 30 +- src/parser/continue_statement/tests.rs | 11 - src/parser/debugger_statement/mod.rs | 19 +- src/parser/debugger_statement/tests.rs | 6 - src/parser/declarations_and_variables/mod.rs | 556 ++++--- .../declarations_and_variables/tests.rs | 13 - src/parser/empty_statement/mod.rs | 17 +- src/parser/empty_statement/tests.rs | 6 - src/parser/equality_operators/mod.rs | 47 +- src/parser/equality_operators/tests.rs | 18 +- src/parser/exponentiation_operator/mod.rs | 52 +- src/parser/exponentiation_operator/tests.rs | 15 +- src/parser/expression_statement/mod.rs | 33 +- src/parser/function_definitions/mod.rs | 185 +-- src/parser/function_definitions/tests.rs | 47 +- .../generator_function_definitions/mod.rs | 179 +-- .../generator_function_definitions/tests.rs | 19 - src/parser/identifiers/mod.rs | 107 +- src/parser/identifiers/tests.rs | 13 - src/parser/if_statement/mod.rs | 49 +- src/parser/iteration_statements/mod.rs | 402 ++--- src/parser/labelled_statements/mod.rs | 108 +- src/parser/left_hand_side_expressions/mod.rs | 712 +++++---- .../left_hand_side_expressions/tests.rs | 170 +- src/parser/method_definitions/mod.rs | 92 +- src/parser/mod.rs | 1197 +++++++++----- src/parser/multiplicative_operators/mod.rs | 67 +- src/parser/multiplicative_operators/tests.rs | 19 +- src/parser/parameter_lists/mod.rs | 147 +- src/parser/primary_expressions/mod.rs | 1115 ++++++------- src/parser/primary_expressions/tests.rs | 329 +--- src/parser/relational_operators/mod.rs | 51 +- src/parser/relational_operators/tests.rs | 34 +- src/parser/return_statement/mod.rs | 30 +- src/parser/scripts/mod.rs | 69 +- src/parser/scripts/tests.rs | 8 +- src/parser/statements_and_declarations/mod.rs | 238 +-- .../statements_and_declarations/tests.rs | 91 +- src/parser/switch_statement/mod.rs | 193 ++- src/parser/testhelp.rs | 1415 +++++++++-------- src/parser/tests.rs | 144 +- src/parser/throw_statement/mod.rs | 27 +- src/parser/try_statement/mod.rs | 163 +- src/parser/unary_operators/mod.rs | 59 +- src/parser/unary_operators/tests.rs | 21 +- src/parser/update_expressions/mod.rs | 59 +- src/parser/update_expressions/tests.rs | 19 +- src/parser/with_statement/mod.rs | 47 +- src/prettyprint/mod.rs | 15 +- src/prettyprint/pp_testhelp.rs | 12 +- src/proxy_object.rs | 35 +- src/realm/mod.rs | 300 ++-- src/realm/tests.rs | 15 +- src/reference/mod.rs | 41 +- src/reflect.rs | 2 +- src/regexp.rs | 17 +- src/regexp/parse.rs | 56 +- src/scanner/mod.rs | 97 +- src/scanner/ranges.rs | 10 +- src/scanner/tests.rs | 160 +- src/string_object/mod.rs | 25 +- src/strings/mod.rs | 66 +- src/symbol_object/mod.rs | 29 +- src/tests/integration.rs | 2 +- src/tests/mod.rs | 142 +- src/values/mod.rs | 279 ++-- src/values/tests.rs | 146 +- 122 files changed, 8076 insertions(+), 7714 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae18460c..2f02ce4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 4 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "ahash" @@ -23,21 +23,21 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy 0.7.35", + "zerocopy", ] [[package]] @@ -57,9 +57,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ "anstyle", "anstyle-parse", @@ -72,44 +72,44 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" [[package]] name = "arraydeque" @@ -119,34 +119,34 @@ checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" [[package]] name = "async-trait" -version = "0.1.88" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -163,9 +163,9 @@ checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" dependencies = [ "serde", ] @@ -181,24 +181,25 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.19" +version = "1.2.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" +checksum = "590f9024a68a8c40351881787f1934dc11afd69090f5edb6831464694d836ea3" dependencies = [ + "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clap" -version = "4.5.36" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2df961d8c8a0d08aa9945718ccf584145eee3f3aa06cddbeac12933781102e04" +checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931" dependencies = [ "clap_builder", "clap_derive", @@ -206,9 +207,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.36" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "132dbda40fb6753878316a489d5a1242a8ef2f0d9e47ba01c951ea8aa7d013a5" +checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6" dependencies = [ "anstream", "anstyle", @@ -218,27 +219,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "color-eyre" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" +checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d" dependencies = [ "backtrace", "color-spantrace", @@ -251,9 +252,9 @@ dependencies = [ [[package]] name = "color-spantrace" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2" +checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427" dependencies = [ "once_cell", "owo-colors", @@ -263,9 +264,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "config" @@ -301,7 +302,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", "once_cell", "tiny-keccak", ] @@ -335,9 +336,9 @@ dependencies = [ [[package]] name = "crunchy" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" @@ -351,9 +352,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.4.0" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc" dependencies = [ "powerfmt", ] @@ -400,9 +401,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", "windows-sys", @@ -424,6 +425,12 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "find-msvc-tools" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e178e4fba8a2726903f6ba98a6d221e76f9c12c650d5dc0e6afdc50677b49650" + [[package]] name = "futures" version = "0.3.31" @@ -480,7 +487,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] [[package]] @@ -555,32 +562,32 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", ] [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasi 0.14.3+wasi-0.2.4", ] [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "hashbrown" @@ -588,15 +595,15 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.8.11", + "ahash 0.8.12", "allocator-api2", ] [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" [[package]] name = "hashlink" @@ -615,18 +622,18 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indenter" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" +checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.15.5", ] [[package]] @@ -669,9 +676,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "linked-hash-map" @@ -687,9 +694,9 @@ checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "minimal-lexical" @@ -699,11 +706,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -839,9 +846,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -852,6 +859,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + [[package]] name = "ordered-multimap" version = "0.7.3" @@ -864,9 +877,9 @@ dependencies = [ [[package]] name = "owo-colors" -version = "3.5.0" +version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" [[package]] name = "pathdiff" @@ -876,20 +889,20 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pest" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", - "thiserror 2.0.12", + "thiserror 2.0.16", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +checksum = "bb056d9e8ea77922845ec74a1c4e8fb17e7c218cc4fc11a15c5d25e189aa40bc" dependencies = [ "pest", "pest_generator", @@ -897,24 +910,23 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +checksum = "87e404e638f781eb3202dc82db6760c8ae8a1eeef7fb3fa8264b2ef280504966" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] [[package]] name = "pest_meta" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +checksum = "edd1101f170f5903fde0914f899bb503d9ff5271d7ba76bbb70bea63690cc0d5" dependencies = [ - "once_cell", "pest", "sha2", ] @@ -943,7 +955,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.8.24", + "zerocopy", ] [[package]] @@ -1014,9 +1026,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -1032,9 +1044,9 @@ dependencies = [ [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rand" @@ -1063,14 +1075,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" dependencies = [ "aho-corasick", "memchr", @@ -1080,9 +1092,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" dependencies = [ "aho-corasick", "memchr", @@ -1091,9 +1103,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" [[package]] name = "res" @@ -1150,15 +1162,15 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustix" -version = "1.0.5" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags", "errno", @@ -1190,14 +1202,14 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" dependencies = [ "itoa", "memchr", @@ -1207,18 +1219,18 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" dependencies = [ "serde", ] [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", @@ -1242,12 +1254,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "strsim" @@ -1268,9 +1277,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -1290,12 +1299,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.19.1" +version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e" dependencies = [ "fastrand", - "getrandom 0.3.2", + "getrandom 0.3.3", "once_cell", "rustix", "windows-sys", @@ -1334,11 +1343,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.16", ] [[package]] @@ -1349,38 +1358,36 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" dependencies = [ "cfg-if", - "once_cell", ] [[package]] name = "time" -version = "0.3.41" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "83bde6f1ec10e72d583d91623c939f623002284ef622b87de38cfd546cbf2031" dependencies = [ "deranged", - "itoa", "libc", "num-conv", "num_threads", @@ -1392,15 +1399,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" dependencies = [ "num-conv", "time-core", @@ -1417,21 +1424,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.20" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.24", + "toml_edit 0.22.27", ] [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" dependencies = [ "serde", ] @@ -1449,17 +1456,24 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.7.6", + "toml_write", + "winnow 0.7.13", ] +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + [[package]] name = "tracing" version = "0.1.41" @@ -1472,9 +1486,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", "valuable", @@ -1492,9 +1506,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" dependencies = [ "sharded-slab", "thread_local", @@ -1557,26 +1571,32 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasi" -version = "0.14.2+wasi-0.2.4" +version = "0.14.3+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "6a51ae83037bdd272a9e28ce236db8c07016dd0d50c27038b3f407533c030c95" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-sys" -version = "0.59.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets", + "windows-targets 0.53.3", ] [[package]] @@ -1585,14 +1605,31 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", ] [[package]] @@ -1601,48 +1638,96 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "winnow" version = "0.5.40" @@ -1654,21 +1739,18 @@ dependencies = [ [[package]] name = "winnow" -version = "0.7.6" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] [[package]] -name = "wit-bindgen-rt" -version = "0.39.0" +name = "wit-bindgen" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags", -] +checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814" [[package]] name = "yaml-rust" @@ -1692,40 +1774,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy" -version = "0.8.24" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ - "zerocopy-derive 0.8.24", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", + "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.106", ] diff --git a/src/agent/mod.rs b/src/agent/mod.rs index d02dce69..8a37b54b 100644 --- a/src/agent/mod.rs +++ b/src/agent/mod.rs @@ -38,8 +38,8 @@ const RECURSION_LIMIT: usize = 90000; // running execution context, the execution context stack, and the Agent Record's fields. #[derive(Debug)] -pub struct Agent { - pub execution_context_stack: RefCell>, +pub(crate) struct Agent { + pub(crate) execution_context_stack: RefCell>, symbols: WellKnownSymbols, obj_id: Cell, symbol_id: Cell, @@ -47,7 +47,7 @@ pub struct Agent { } thread_local! { - pub static AGENT: Agent = Agent::new(); + pub(crate) static AGENT: Agent = Agent::new(); } impl Default for Agent { @@ -57,51 +57,51 @@ impl Default for Agent { } impl Agent { - pub fn new() -> Self { + pub(crate) fn new() -> Self { Agent { obj_id: Cell::new(1), execution_context_stack: RefCell::new(vec![]), symbols: WellKnownSymbols { - async_iterator_: Symbol(Rc::new(SymbolInternals { + async_iterator: Symbol(Rc::new(SymbolInternals { id: 1, description: Some(JSString::from("Symbol.asyncIterator")), })), - has_instance_: Symbol(Rc::new(SymbolInternals { + has_instance: Symbol(Rc::new(SymbolInternals { id: 2, description: Some(JSString::from("Symbol.hasInstance")), })), - is_concat_spreadable_: Symbol(Rc::new(SymbolInternals { + is_concat_spreadable: Symbol(Rc::new(SymbolInternals { id: 3, description: Some(JSString::from("Symbol.isConcatSpreadable")), })), - iterator_: Symbol(Rc::new(SymbolInternals { + iterator: Symbol(Rc::new(SymbolInternals { id: 4, description: Some(JSString::from("Symbol.iterator")), })), match_: Symbol(Rc::new(SymbolInternals { id: 5, description: Some(JSString::from("Symbol.match")) })), - match_all_: Symbol(Rc::new(SymbolInternals { + match_all: Symbol(Rc::new(SymbolInternals { id: 6, description: Some(JSString::from("Symbol.matchAll")), })), - replace_: Symbol(Rc::new(SymbolInternals { + replace: Symbol(Rc::new(SymbolInternals { id: 7, description: Some(JSString::from("Symbol.replace")), })), - search_: Symbol(Rc::new(SymbolInternals { id: 8, description: Some(JSString::from("Symbol.search")) })), - species_: Symbol(Rc::new(SymbolInternals { + search: Symbol(Rc::new(SymbolInternals { id: 8, description: Some(JSString::from("Symbol.search")) })), + species: Symbol(Rc::new(SymbolInternals { id: 9, description: Some(JSString::from("Symbol.species")), })), - split_: Symbol(Rc::new(SymbolInternals { id: 10, description: Some(JSString::from("Symbol.split")) })), - to_primitive_: Symbol(Rc::new(SymbolInternals { + split: Symbol(Rc::new(SymbolInternals { id: 10, description: Some(JSString::from("Symbol.split")) })), + to_primitive: Symbol(Rc::new(SymbolInternals { id: 11, description: Some(JSString::from("Symbol.toPrimitive")), })), - to_string_tag_: Symbol(Rc::new(SymbolInternals { + to_string_tag: Symbol(Rc::new(SymbolInternals { id: 12, description: Some(JSString::from("Symbol.toStringTag")), })), - unscopables_: Symbol(Rc::new(SymbolInternals { + unscopables: Symbol(Rc::new(SymbolInternals { id: 13, description: Some(JSString::from("Symbol.unscopables")), })), @@ -111,7 +111,8 @@ impl Agent { } } - pub fn reset(&self) { + #[cfg(test)] + pub(crate) fn reset(&self) { self.obj_id.set(1); self.execution_context_stack.borrow_mut().clear(); self.symbol_id.set(14); @@ -119,7 +120,7 @@ impl Agent { } } -pub fn active_function_object() -> Option { +pub(crate) fn active_function_object() -> Option { AGENT.with(|agent| { let stack = agent.execution_context_stack.borrow(); match stack.len() { @@ -132,7 +133,7 @@ pub fn active_function_object() -> Option { /// Return the active script or module record associated with the current execution /// /// See [GetActiveScriptOrModule](https://tc39.es/ecma262/#sec-getactivescriptormodule) from ECMA-262. -pub fn get_active_script_or_module() -> Option { +pub(crate) fn get_active_script_or_module() -> Option { // GetActiveScriptOrModule ( ) // // The abstract operation GetActiveScriptOrModule takes no arguments and returns a Script Record, a Module @@ -153,7 +154,7 @@ pub fn get_active_script_or_module() -> Option { }) } -pub fn current_script_or_module() -> Option { +pub(crate) fn current_script_or_module() -> Option { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); let ec = &execution_context_stack[execution_context_stack.len() - 1]; @@ -161,7 +162,7 @@ pub fn current_script_or_module() -> Option { }) } -pub fn next_object_id() -> usize { +pub(crate) fn next_object_id() -> usize { AGENT.with(|agent| { // Note: single threaded, so no worries about read-then-write trouble. let result = agent.obj_id.get(); @@ -171,7 +172,7 @@ pub fn next_object_id() -> usize { }) } -pub fn next_symbol_id() -> usize { +pub(crate) fn next_symbol_id() -> usize { AGENT.with(|agent| { let result = agent.symbol_id.get(); assert!(result < usize::MAX); @@ -180,15 +181,15 @@ pub fn next_symbol_id() -> usize { }) } -pub fn push_execution_context(context: ExecutionContext) { +pub(crate) fn push_execution_context(context: ExecutionContext) { AGENT.with(|agent| agent.execution_context_stack.borrow_mut().push(context)); } -pub fn pop_execution_context() { +pub(crate) fn pop_execution_context() { AGENT.with(|agent| agent.execution_context_stack.borrow_mut().pop()); } -pub fn ec_push(val: FullCompletion) { +pub(crate) fn ec_push(val: FullCompletion) { AGENT.with(|agent| { let mut ec_stack = agent.execution_context_stack.borrow_mut(); let len = ec_stack.len(); @@ -198,7 +199,7 @@ pub fn ec_push(val: FullCompletion) { }); } -pub fn ec_pop() -> Option { +pub(crate) fn ec_pop() -> Option { AGENT.with(|agent| { let mut execution_context_stack = agent.execution_context_stack.borrow_mut(); let len = execution_context_stack.len(); @@ -212,7 +213,8 @@ pub fn ec_pop() -> Option { }) } -pub fn ec_peek(from_end: usize) -> Option { +#[cfg(test)] +pub(crate) fn ec_peek(from_end: usize) -> Option { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); let len = execution_context_stack.len(); @@ -230,7 +232,8 @@ pub fn ec_peek(from_end: usize) -> Option { }) } -pub fn ec_pop_list() -> anyhow::Result> { +#[cfg(test)] +pub(crate) fn ec_pop_list() -> anyhow::Result> { AGENT.with(|agent| { let mut ec_stack = agent.execution_context_stack.borrow_mut(); let ec = ec_stack.last_mut().ok_or_else(|| anyhow!("no execution context"))?; @@ -253,14 +256,15 @@ pub fn ec_pop_list() -> anyhow::Result> { }) } -pub fn execution_context_stack_len() -> usize { +#[cfg(test)] +pub(crate) fn execution_context_stack_len() -> usize { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); execution_context_stack.len() }) } -pub fn ec_stack_len() -> usize { +pub(crate) fn ec_stack_len() -> usize { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); let len = execution_context_stack.len(); @@ -274,34 +278,34 @@ pub fn ec_stack_len() -> usize { }) } -pub fn wks(sym_id: WksId) -> Symbol { +pub(crate) fn wks(sym_id: WksId) -> Symbol { AGENT.with(|agent| { match sym_id { - WksId::AsyncIterator => &agent.symbols.async_iterator_, - WksId::HasInstance => &agent.symbols.has_instance_, - WksId::IsConcatSpreadable => &agent.symbols.is_concat_spreadable_, - WksId::Iterator => &agent.symbols.iterator_, + WksId::AsyncIterator => &agent.symbols.async_iterator, + WksId::HasInstance => &agent.symbols.has_instance, + WksId::IsConcatSpreadable => &agent.symbols.is_concat_spreadable, + WksId::Iterator => &agent.symbols.iterator, WksId::Match => &agent.symbols.match_, - WksId::MatchAll => &agent.symbols.match_all_, - WksId::Replace => &agent.symbols.replace_, - WksId::Search => &agent.symbols.search_, - WksId::Species => &agent.symbols.species_, - WksId::Split => &agent.symbols.split_, - WksId::ToPrimitive => &agent.symbols.to_primitive_, - WksId::ToStringTag => &agent.symbols.to_string_tag_, - WksId::Unscopables => &agent.symbols.unscopables_, + WksId::MatchAll => &agent.symbols.match_all, + WksId::Replace => &agent.symbols.replace, + WksId::Search => &agent.symbols.search, + WksId::Species => &agent.symbols.species, + WksId::Split => &agent.symbols.split, + WksId::ToPrimitive => &agent.symbols.to_primitive, + WksId::ToStringTag => &agent.symbols.to_string_tag, + WksId::Unscopables => &agent.symbols.unscopables, } .clone() }) } -pub fn intrinsic(id: IntrinsicId) -> Object { +pub(crate) fn intrinsic(id: IntrinsicId) -> Object { let realm_ref = current_realm_record().unwrap(); let realm = realm_ref.borrow(); realm.intrinsics.get(id) } -pub fn current_realm_record() -> Option>> { +pub(crate) fn current_realm_record() -> Option>> { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); match execution_context_stack.len() { @@ -311,7 +315,7 @@ pub fn current_realm_record() -> Option>> { }) } -pub fn current_lexical_environment() -> Option> { +pub(crate) fn current_lexical_environment() -> Option> { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); match execution_context_stack.len() { @@ -321,7 +325,7 @@ pub fn current_lexical_environment() -> Option> { }) } -pub fn current_variable_environment() -> Option> { +pub(crate) fn current_variable_environment() -> Option> { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); match execution_context_stack.len() { @@ -331,14 +335,14 @@ pub fn current_variable_environment() -> Option> { }) } -pub fn current_private_environment() -> Option>> { +pub(crate) fn current_private_environment() -> Option>> { AGENT.with(|agent| { let execution_context_stack = agent.execution_context_stack.borrow(); execution_context_stack.last().and_then(|context| context.private_environment.clone()) }) } -pub fn set_lexical_environment(env: Option>) { +pub(crate) fn set_lexical_environment(env: Option>) { AGENT.with(|agent| { let mut execution_context_stack = agent.execution_context_stack.borrow_mut(); if let Some(context) = execution_context_stack.last_mut() { @@ -347,7 +351,7 @@ pub fn set_lexical_environment(env: Option>) { }); } -pub fn set_variable_environment(env: Option>) { +pub(crate) fn set_variable_environment(env: Option>) { AGENT.with(|agent| { let mut execution_context_stack = agent.execution_context_stack.borrow_mut(); if let Some(context) = execution_context_stack.last_mut() { @@ -356,7 +360,7 @@ pub fn set_variable_environment(env: Option>) { }); } -pub fn set_private_environment(env: Option>>) { +pub(crate) fn set_private_environment(env: Option>>) { AGENT.with(|agent| { let mut execution_context_stack = agent.execution_context_stack.borrow_mut(); if let Some(context) = execution_context_stack.last_mut() { @@ -379,7 +383,7 @@ pub fn set_private_environment(env: Option> // 5. Let newGlobalEnv be NewGlobalEnvironment(globalObj, thisValue). // 6. Set realmRec.[[GlobalEnv]] to newGlobalEnv. // 7. Return realmRec. -pub fn set_realm_global_object(global_obj: Option, this_value: Option) { +pub(crate) fn set_realm_global_object(global_obj: Option, this_value: Option) { let go = global_obj.unwrap_or_else(|| { let object_proto = intrinsic(IntrinsicId::ObjectPrototype); ordinary_object_create(Some(object_proto)) @@ -406,7 +410,7 @@ pub fn set_realm_global_object(global_obj: Option, this_value: Option Rc> { +pub(crate) fn global_symbol_registry() -> Rc> { AGENT.with(|agent| agent.gsr.borrow().as_ref().unwrap().clone()) } impl Agent { - pub fn set_global_symbol_registry(&self, gsr: Rc>) { + pub(crate) fn set_global_symbol_registry(&self, gsr: Rc>) { assert!(self.gsr.borrow().is_none(), "GSR: Attempted change after having already been set"); *self.gsr.borrow_mut() = Some(gsr); } } -pub fn evaluate(chunk: Rc, source: &SourceTree) -> Completion { +pub(crate) fn evaluate(chunk: Rc, source: &SourceTree) -> Completion { AGENT.with(|agent| { if agent.execution_context_stack.borrow().is_empty() { return Err(create_type_error("No active execution context")); @@ -706,7 +710,7 @@ pub fn evaluate(chunk: Rc, source: &SourceTree) -> Completion) { +pub(crate) fn prepare_running_ec_for_execution(chunk: Rc) { AGENT.with(|agent| { assert!(!agent.execution_context_stack.borrow().is_empty()); let index = agent.execution_context_stack.borrow().len() - 1; @@ -714,7 +718,7 @@ pub fn prepare_running_ec_for_execution(chunk: Rc) { }); } -pub fn prepare_for_execution(index: usize, chunk: Rc) { +pub(crate) fn prepare_for_execution(index: usize, chunk: Rc) { AGENT.with(|agent| { let mut execution_context_stack = agent.execution_context_stack.borrow_mut(); execution_context_stack[index].chunk = Some(chunk); @@ -723,7 +727,7 @@ pub fn prepare_for_execution(index: usize, chunk: Rc) { } #[derive(Debug, PartialEq, Eq, Copy, Clone, Error)] -pub enum InternalRuntimeError { +pub(crate) enum InternalRuntimeError { #[error("no active execution context")] NoContext, #[error("runtime stack is empty")] @@ -792,8 +796,6 @@ pub enum InternalRuntimeError { SetterMethodExpected, #[error("generator expected")] GeneratorExpected, - #[error("Normal, Throw, or Return completion expected")] - OkThrowOrReturnExpected, #[error("parent expected for current lexical environment")] NoParentLexicalEnvironment, #[error("PrivateElement accessor expected")] @@ -1010,27 +1012,27 @@ mod insn_impl { Ok(()) }) } - pub fn nop() { + pub(crate) fn nop() { // surprise. Do Nothing. } - pub fn todo() -> ! { + pub(crate) fn todo() -> ! { // emit a todo error todo!() } - pub fn pop() -> anyhow::Result<()> { + pub(crate) fn pop() -> anyhow::Result<()> { // Input: Stack: item // Output: Stack: let _ = pop_completion()?; Ok(()) } - pub fn string(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn string(chunk: &Rc) -> anyhow::Result<()> { // Input: argument: index; // stack: no input // Output: ECMA String value added to the stack let string = string_operand(chunk)?; push_value(ECMAScriptValue::String(string.clone())) } - pub fn float(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn float(chunk: &Rc) -> anyhow::Result<()> { // Input: argument: index; // stack: no input // Output: ECMA Number value added to the stack @@ -1038,7 +1040,7 @@ mod insn_impl { let float = chunk.floats.get(float_index as usize).ok_or(InternalRuntimeError::FloatIndexOOB)?; push_value(ECMAScriptValue::Number(*float)) } - pub fn bigint(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn bigint(chunk: &Rc) -> anyhow::Result<()> { // Input: argument: index; // stack: no input // Output: ECMA BigInt value added to the stack @@ -1046,32 +1048,32 @@ mod insn_impl { let bigint = chunk.bigints.get(bigint_index as usize).ok_or(InternalRuntimeError::BigintIndexOOB)?; push_value(ECMAScriptValue::BigInt(bigint.clone())) } - pub fn null() -> anyhow::Result<()> { + pub(crate) fn null() -> anyhow::Result<()> { // Input: nothing // Output: ECMA value NULL on the stack push_value(ECMAScriptValue::Null) } - pub fn true_val() -> anyhow::Result<()> { + pub(crate) fn true_val() -> anyhow::Result<()> { // Input: Nothing // Output: ECMA value TRUE on the stack push_value(ECMAScriptValue::Boolean(true)) } - pub fn false_val() -> anyhow::Result<()> { + pub(crate) fn false_val() -> anyhow::Result<()> { // Input: Nothing // Output: ECMA value FALSE on the stack push_value(ECMAScriptValue::Boolean(false)) } - pub fn zero() -> anyhow::Result<()> { + pub(crate) fn zero() -> anyhow::Result<()> { // Input: Nothing // Output: ECMA value 0.0 on the stack push_value(ECMAScriptValue::Number(0.0)) } - pub fn empty() -> anyhow::Result<()> { + pub(crate) fn empty() -> anyhow::Result<()> { // Input: Nothing // Output: [ empty ] on the stack push_completion(Ok(NormalCompletion::Empty)) } - pub fn empty_if_not_error() -> anyhow::Result<()> { + pub(crate) fn empty_if_not_error() -> anyhow::Result<()> { // Input: Stack one item. // Output: On stack: item if item is an error, else [ empty ] let completion = pop_completion()?; @@ -1080,12 +1082,12 @@ mod insn_impl { Err(_) => completion, }) } - pub fn undefined() -> anyhow::Result<()> { + pub(crate) fn undefined() -> anyhow::Result<()> { // Input: Nothing // Output: Undefined on the stack push_value(ECMAScriptValue::Undefined) } - pub fn undefined_if_empty() -> anyhow::Result<()> { + pub(crate) fn undefined_if_empty() -> anyhow::Result<()> { // Input: err/val/empty // Output: err/val/undefined let completion = pop_completion()?; @@ -1093,23 +1095,23 @@ mod insn_impl { push_completion(new_completion).expect(PUSHABLE); Ok(()) } - pub fn function_prototype() -> anyhow::Result<()> { + pub(crate) fn function_prototype() -> anyhow::Result<()> { // Input: None // Output: Stack: Current realm's %Function.prototype% push_value(ECMAScriptValue::Object(intrinsic(IntrinsicId::FunctionPrototype))) } - pub fn object_prototype() -> anyhow::Result<()> { + pub(crate) fn object_prototype() -> anyhow::Result<()> { // Input: None // Output:: Stack: Current realm's %Object.prototype% push_value(ECMAScriptValue::Object(intrinsic(IntrinsicId::ObjectPrototype))) } - pub fn this() -> anyhow::Result<()> { + pub(crate) fn this() -> anyhow::Result<()> { // Input: Nothing // Output: the result of ResolveThisBinding on the stack. let this_resolved = resolve_this_binding().map(NormalCompletion::from); push_completion(this_resolved) } - pub fn resolve(strict: bool) -> anyhow::Result<()> { + pub(crate) fn resolve(strict: bool) -> anyhow::Result<()> { // Input: A string item on the stack // Output: A resolved binding for that string on the stack let name = pop_string()?; @@ -1117,7 +1119,7 @@ mod insn_impl { push_completion(resolved).expect(PUSHABLE); Ok(()) } - pub fn get_value() -> anyhow::Result<()> { + pub(crate) fn get_value() -> anyhow::Result<()> { // Input: Stack: A reference, value, or error. // Output: Stack: The error, the value, or a value from dereferencing the reference let reference = pop_completion()?; @@ -1125,7 +1127,7 @@ mod insn_impl { push_completion(value.map(NormalCompletion::from)).expect(PUSHABLE); Ok(()) } - pub fn put_value() -> anyhow::Result<()> { + pub(crate) fn put_value() -> anyhow::Result<()> { // Input: Stack, 2 args: the value to store, then the reference to store it in. // Output Stack: [empty] or error let wc = pop_completion()?; @@ -1140,7 +1142,7 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump_if_abrupt(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump_if_abrupt(chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: any completion (NOT CONSUMED) // Output: nothing let jump = operand(chunk)? as i16; @@ -1151,7 +1153,7 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump_if_normal(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump_if_normal(chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: any completion (NOT CONSUMED) // Output: nothing let jump = operand(chunk)? as i16; @@ -1162,7 +1164,7 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump_referencing_bool(bool_match: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump_referencing_bool(bool_match: bool, chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: any value (NOT CONSUMED) // Output: nothing let jump = operand(chunk)? as i16; @@ -1174,7 +1176,7 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump_taking_bool(bool_match: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump_taking_bool(bool_match: bool, chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: any value // Output: nothing let jump = operand(chunk)? as i16; @@ -1186,7 +1188,7 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump_nullishness(nullish: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump_nullishness(nullish: bool, chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: any value (NOT CONSUMED) // Output: nothing let jump = operand(chunk)? as i16; @@ -1198,7 +1200,7 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump_undefness(undef: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump_undefness(undef: bool, chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: any value (NOT CONSUMED) // Output: nothing let jump = operand(chunk)? as i16; @@ -1210,7 +1212,7 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump_throwyness(throw: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump_throwyness(throw: bool, chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: any value (NOT CONSUMED) // Output: nothing let jump = operand(chunk)? as i16; @@ -1222,13 +1224,13 @@ mod insn_impl { Ok(()) } #[expect(clippy::cast_possible_wrap)] - pub fn jump(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn jump(chunk: &Rc) -> anyhow::Result<()> { // Input: operand: i16 instruction offset. Stack: nothing // Output: nothing let jump = operand(chunk)? as i16; bump_pc(jump) } - pub fn update_empty() -> anyhow::Result<()> { + pub(crate) fn update_empty() -> anyhow::Result<()> { // Input: on stack: newer (any completion) // older (any normal completion) // Output: on stack: the result of UpdateEmpty @@ -1237,7 +1239,7 @@ mod insn_impl { push_completion(super::update_empty(newer, older)).expect(PUSHABLE); Ok(()) } - pub fn pop2push3() -> anyhow::Result<()> { + pub(crate) fn pop2push3() -> anyhow::Result<()> { // Input: Stack: top lower // Output: Stack: top lower top let top = pop_completion()?; @@ -1248,14 +1250,14 @@ mod insn_impl { push_completion(top).expect(PUSHABLE); Ok(()) } - pub fn dup() -> anyhow::Result<()> { + pub(crate) fn dup() -> anyhow::Result<()> { // Input: Stack: item // Output: Stack: item item let item = peek_completion(0)?; push_completion(item).expect(PUSHABLE); Ok(()) } - pub fn dup_after_list() -> anyhow::Result<()> { + pub(crate) fn dup_after_list() -> anyhow::Result<()> { // stack has a list followed by a value: N item(n-1) ... item(0) value // output dups that value behind the list: N item(n-1) ... item(0) value value let list_len = peek_usize(0)?; @@ -1274,7 +1276,7 @@ mod insn_impl { Ok(()) }) } - pub fn swap() -> anyhow::Result<()> { + pub(crate) fn swap() -> anyhow::Result<()> { // Input: Stack: A B // Output: Stack: B A AGENT.with(|agent| -> anyhow::Result<()> { @@ -1289,7 +1291,7 @@ mod insn_impl { } }) } - pub fn rotate_up(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn rotate_up(chunk: &Rc) -> anyhow::Result<()> { // a 1-arg instruction: take the n-th item in the stack and move it to the top, sliding the others // down. E.g.: with A, B, C, D on the stack (top on the left), "RotateUp 3" will produce C, A, B, D. let amt = operand(chunk)? as usize; @@ -1306,7 +1308,7 @@ mod insn_impl { } }) } - pub fn rotate_down(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn rotate_down(chunk: &Rc) -> anyhow::Result<()> { // a 1-arg instruction: take the top item of the stack and move it down until it becomes the n-th item in the // stack, sliding the others up. E.g.: with A, B, C, D on the stack (top on the left), "RotateDown 3" will // produce B, C, A, D. @@ -1324,7 +1326,7 @@ mod insn_impl { } }) } - pub fn rotate_down_list(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn rotate_down_list(chunk: &Rc) -> anyhow::Result<()> { // a 1-arg instruction (N) // Given a stack, ITEM LIST B C D, move ITEM down past the list plus N more items. let amt = operand(chunk)? as usize; @@ -1342,7 +1344,7 @@ mod insn_impl { } }) } - pub fn rotate_list_down(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn rotate_list_down(chunk: &Rc) -> anyhow::Result<()> { // Input: Operand N // Input: Stack: LIST item1 item2 ... itemN // Output Stack: item1 item2 ... itemN LIST @@ -1361,7 +1363,7 @@ mod insn_impl { } }) } - pub fn rotate_list_up(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn rotate_list_up(chunk: &Rc) -> anyhow::Result<()> { // Input: Operand: N // Input: Stack: item1 item2 ... itemN LIST // Output Stack: LIST item1 item2 ... itemN @@ -1380,7 +1382,7 @@ mod insn_impl { } }) } - pub fn make_ref(strict: bool) -> anyhow::Result<()> { + pub(crate) fn make_ref(strict: bool) -> anyhow::Result<()> { // Input: Stack: name base // Output: Stack: reference let name = pop_value()?; @@ -1390,7 +1392,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn make_super_property_ref(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn make_super_property_ref(chunk: &Rc) -> anyhow::Result<()> { // Input: operand: 0 == not-strict; 1 == strict // Input: Stack: key this // Output: Stack: err/ref @@ -1401,14 +1403,14 @@ mod insn_impl { push_completion(super_ref).expect(PUSHABLE); Ok(()) } - pub fn pop_or_panic() -> anyhow::Result<()> { + pub(crate) fn pop_or_panic() -> anyhow::Result<()> { let val = pop_completion()?; if let Err(e) = val { panic!("Unhandled, unexpected error {e}"); } Ok(()) } - pub fn swap_list() -> anyhow::Result<()> { + pub(crate) fn swap_list() -> anyhow::Result<()> { // Input: LIST ITEM // Output: ITEM LIST let list_len = usize_at(0)?; @@ -1426,7 +1428,7 @@ mod insn_impl { push_completion(item).expect(PUSHABLE); Ok(()) } - pub fn pop_list() -> anyhow::Result<()> { + pub(crate) fn pop_list() -> anyhow::Result<()> { // Input: LIST // Output: let length = pop_usize()?; @@ -1443,7 +1445,7 @@ mod insn_impl { } }) } - pub fn pop_out_list(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn pop_out_list(chunk: &Rc) -> anyhow::Result<()> { // Input: operand: "N" // Input: Stack: item1 ... item(n-1) LIST // Output: Stack: item1 ... item(n-1) @@ -1468,7 +1470,7 @@ mod insn_impl { } }) } - pub fn swap_deep_list() -> anyhow::Result<()> { + pub(crate) fn swap_deep_list() -> anyhow::Result<()> { // Input: LIST_A item LIST_B // Output: LIST_A LIST_B item let a_len = usize_at(0)?; @@ -1486,7 +1488,7 @@ mod insn_impl { Ok(()) }) } - pub fn list_to_array() -> anyhow::Result<()> { + pub(crate) fn list_to_array() -> anyhow::Result<()> { // On the stack at the start: N list[N-1] ... list[0] // Afterward: A let array_len = pop_usize()?; @@ -1526,16 +1528,16 @@ mod insn_impl { Ok(()) }) } - pub fn unwind(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn unwind(chunk: &Rc) -> anyhow::Result<()> { let vals_to_remove = usize_operand(chunk)?; unwind_internal(vals_to_remove) } - pub fn unwind_if_abrupt(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn unwind_if_abrupt(chunk: &Rc) -> anyhow::Result<()> { let vals_to_remove = usize_operand(chunk)?; let top_completion = peek_completion(0)?; if top_completion.is_err() && vals_to_remove > 0 { unwind_internal(vals_to_remove) } else { Ok(()) } } - pub fn unwind_list() -> anyhow::Result<()> { + pub(crate) fn unwind_list() -> anyhow::Result<()> { let err_to_keep = pop_completion()?; let vals_to_remove = pop_usize()?; if vals_to_remove > 0 { @@ -1555,7 +1557,7 @@ mod insn_impl { push_completion(err_to_keep).expect(PUSHABLE); Ok(()) } - pub fn initialize_referenced_binding() -> anyhow::Result<()> { + pub(crate) fn initialize_referenced_binding() -> anyhow::Result<()> { // Input: Stack: (value to store) (place to store) // Output: Stack: [empty] or error let value = match pop_completion().context("InitializeReferencedBinding takes two arguments (got none)")?.map(ECMAScriptValue::try_from) { @@ -1568,32 +1570,32 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn push_new_lexical_environment() { + pub(crate) fn push_new_lexical_environment() { let current_env = current_lexical_environment(); let new_env = DeclarativeEnvironmentRecord::new(current_env, "inner block"); set_lexical_environment(Some(Rc::new(new_env))); } - pub fn pop_lexical_environment() -> anyhow::Result<()> { + pub(crate) fn pop_lexical_environment() -> anyhow::Result<()> { let current_env = current_lexical_environment().ok_or(InternalRuntimeError::NoLexicalEnvironment)?; let outer_env = current_env.get_outer_env(); set_lexical_environment(outer_env); Ok(()) } - pub fn push_new_var_env_from_lex() { + pub(crate) fn push_new_var_env_from_lex() { let current_env = current_lexical_environment(); let new_env = DeclarativeEnvironmentRecord::new(current_env, "new var env"); set_variable_environment(Some(Rc::new(new_env))); } - pub fn push_new_lex_env_from_var() { + pub(crate) fn push_new_lex_env_from_var() { let current_env = current_variable_environment(); let new_env = DeclarativeEnvironmentRecord::new(current_env, "new var env"); set_lexical_environment(Some(Rc::new(new_env))); } - pub fn set_lex_env_to_var_env() { + pub(crate) fn set_lex_env_to_var_env() { let current_env = current_variable_environment(); set_lexical_environment(current_env); } - pub fn set_aside_lex_env() -> anyhow::Result<()> { + pub(crate) fn set_aside_lex_env() -> anyhow::Result<()> { // Input: None // Output on Stack: the top lexical environment (which is then popped) let current_env = current_lexical_environment().ok_or(InternalRuntimeError::NoLexicalEnvironment)?; @@ -1601,7 +1603,7 @@ mod insn_impl { set_lexical_environment(Some(outer_env)); push_completion(Ok(NormalCompletion::Environment(current_env))) } - pub fn restore_lex_env() -> anyhow::Result<()> { + pub(crate) fn restore_lex_env() -> anyhow::Result<()> { // Input on stack: Env // Output: None let completion = pop_completion()?.or(Err(InternalRuntimeError::NonErrorExpected))?; @@ -1609,20 +1611,20 @@ mod insn_impl { set_lexical_environment(Some(env)); Ok(()) } - pub fn push_new_private_env() { + pub(crate) fn push_new_private_env() { // Input: None; Output: None let outer_private_environment = current_private_environment(); let new_private_environment = PrivateEnvironmentRecord::new(outer_private_environment); set_private_environment(Some(Rc::new(RefCell::new(new_private_environment)))); } - pub fn pop_private_env() -> anyhow::Result<()> { + pub(crate) fn pop_private_env() -> anyhow::Result<()> { // Input: None; Output: None let current_private_environment = current_private_environment().ok_or(InternalRuntimeError::NoPrivateEnv)?; let parent = current_private_environment.borrow().outer_private_environment.clone(); set_private_environment(parent); Ok(()) } - pub fn push_new_with_env() -> anyhow::Result<()> { + pub(crate) fn push_new_with_env() -> anyhow::Result<()> { // Input: Stack: obj // Output: nothing on stack let obj = Object::try_from(pop_value()?)?; @@ -1631,7 +1633,7 @@ mod insn_impl { set_lexical_environment(Some(Rc::new(environment))); Ok(()) } - pub fn create_immutable_lex_binding(strict: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn create_immutable_lex_binding(strict: bool, chunk: &Rc) -> anyhow::Result<()> { let env = current_lexical_environment().ok_or(InternalRuntimeError::NoLexicalEnvironment)?; let name = string_operand(chunk)?; @@ -1647,15 +1649,15 @@ mod insn_impl { env.create_mutable_binding(name.clone(), deletable).or(Err(InternalRuntimeError::BindingAlreadyExists))?; Ok(()) } - pub fn create_mutable_lexical_binding(deletable: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn create_mutable_lexical_binding(deletable: bool, chunk: &Rc) -> anyhow::Result<()> { let env = current_lexical_environment().ok_or(InternalRuntimeError::NoLexicalEnvironment)?; create_mutable_binding(&env, deletable, chunk) } - pub fn create_mutable_var_binding(deletable: bool, chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn create_mutable_var_binding(deletable: bool, chunk: &Rc) -> anyhow::Result<()> { let env = current_variable_environment().ok_or(InternalRuntimeError::NoVarEnvironment)?; create_mutable_binding(&env, deletable, chunk) } - pub fn create_mutable_lexical_binding_if_missing(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn create_mutable_lexical_binding_if_missing(chunk: &Rc) -> anyhow::Result<()> { // 1. Let alreadyDeclared be ! env.HasBinding(paramName). // 2. If alreadyDeclared is false, then // a. Perform ! env.CreateMutableBinding(paramName, false). @@ -1669,7 +1671,9 @@ mod insn_impl { } Ok(()) } - pub fn create_initialized_permanent_mutable_lexical_binding_if_missing(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn create_initialized_permanent_mutable_lexical_binding_if_missing( + chunk: &Rc, + ) -> anyhow::Result<()> { // 1. Let alreadyDeclared be ! env.HasBinding(paramName). // 2. If alreadyDeclared is false, then // a. Perform ! env.CreateMutableBinding(paramName, false). @@ -1692,28 +1696,28 @@ mod insn_impl { env.initialize_binding(name, value).or(Err(InternalRuntimeError::InitializeBindingFailure))?; Ok(()) } - pub fn initialize_lex_binding(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn initialize_lex_binding(chunk: &Rc) -> anyhow::Result<()> { let env = current_lexical_environment().ok_or(InternalRuntimeError::NoLexicalEnvironment)?; initialize_binding(&env, chunk) } - pub fn initialize_var_binding(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn initialize_var_binding(chunk: &Rc) -> anyhow::Result<()> { let env = current_variable_environment().ok_or(InternalRuntimeError::NoVarEnvironment)?; initialize_binding(&env, chunk) } - pub fn get_lex_binding(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn get_lex_binding(chunk: &Rc) -> anyhow::Result<()> { let env = current_lexical_environment().ok_or(InternalRuntimeError::NoLexicalEnvironment)?; let name = string_operand(chunk)?; let value = env.get_binding_value(name, false).or(Err(InternalRuntimeError::GetBindingValueFailure))?; push_value(value) } - pub fn set_mutable_var_binding(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn set_mutable_var_binding(chunk: &Rc) -> anyhow::Result<()> { let env = current_variable_environment().ok_or(InternalRuntimeError::NoVarEnvironment)?; let name = string_operand(chunk)?; let value = pop_value()?; env.set_mutable_binding(name.clone(), value, false).or(Err(InternalRuntimeError::SetMutableBindingFailure))?; Ok(()) } - pub fn create_private_name_if_missing(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn create_private_name_if_missing(chunk: &Rc) -> anyhow::Result<()> { // Input operand: string Index let name = string_operand(chunk)?; let pe_holder = current_private_environment().ok_or(InternalRuntimeError::NoPrivateEnv)?; @@ -1724,7 +1728,7 @@ mod insn_impl { } Ok(()) } - pub fn create_per_iteration_environment(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn create_per_iteration_environment(chunk: &Rc) -> anyhow::Result<()> { // A 1-operand instruction that takes nothing from the stack as input, and produces one // stack item ([empty]/error) on exit. let string_set = string_set_operand(chunk)?; @@ -1732,7 +1736,7 @@ mod insn_impl { push_completion(res)?; Ok(()) } - pub fn extract_thrown_value() -> anyhow::Result<()> { + pub(crate) fn extract_thrown_value() -> anyhow::Result<()> { let item = pop_completion()?; match item { Err(AbruptCompletion::Throw { value }) => { @@ -1742,7 +1746,7 @@ mod insn_impl { } Ok(()) } - pub fn extract_arg() -> anyhow::Result<()> { + pub(crate) fn extract_arg() -> anyhow::Result<()> { // Stack: N arg[N-1] arg[N-2] ... arg[1] arg[0] (when N >= 1) // Out: arg[0] N-1 arg[N-1] arg[N-2] ... arg[1] // --or, if N == 0 -- @@ -1769,7 +1773,7 @@ mod insn_impl { }) } } - pub fn finish_args() -> anyhow::Result<()> { + pub(crate) fn finish_args() -> anyhow::Result<()> { // Stack: N arg[N-1] ... arg[0] // Out: // Remove any remaining arguments from the stack (we're at zero, or the caller gave us too much) @@ -1787,23 +1791,23 @@ mod insn_impl { Ok(()) }) } - pub fn object() -> anyhow::Result<()> { + pub(crate) fn object() -> anyhow::Result<()> { let obj_proto = intrinsic(IntrinsicId::ObjectPrototype); let o = ordinary_object_create(Some(obj_proto)); push_value(ECMAScriptValue::Object(o)) } - pub fn object_with_proto() -> anyhow::Result<()> { + pub(crate) fn object_with_proto() -> anyhow::Result<()> { // Input on stack: proto // Output on stack: object let proto: Option = pop_value()?.try_into()?; let o = ordinary_object_create(proto); push_value(ECMAScriptValue::Object(o)) } - pub fn array() -> anyhow::Result<()> { + pub(crate) fn array() -> anyhow::Result<()> { let array = array_create(0.0, None).expect("Arrays of length zero are not too large"); push_value(ECMAScriptValue::Object(array)) } - pub fn create_data_property() -> anyhow::Result<()> { + pub(crate) fn create_data_property() -> anyhow::Result<()> { let value = pop_value()?; let nc_name = pop_completion()?.or(Err(InternalRuntimeError::NonErrorExpected))?; let nc_obj = pop_completion()?.or(Err(InternalRuntimeError::NonErrorExpected))?; @@ -1813,7 +1817,7 @@ mod insn_impl { push_value(ECMAScriptValue::Object(obj)).expect(PUSHABLE); Ok(()) } - pub fn set_prototype() -> anyhow::Result<()> { + pub(crate) fn set_prototype() -> anyhow::Result<()> { let value = pop_value()?; let nc_obj = pop_completion()?.or(Err(InternalRuntimeError::NonErrorExpected))?; let obj = Object::try_from(nc_obj)?; @@ -1824,43 +1828,43 @@ mod insn_impl { push_value(ECMAScriptValue::Object(obj)).expect(PUSHABLE); Ok(()) } - pub fn to_property_key() -> anyhow::Result<()> { + pub(crate) fn to_property_key() -> anyhow::Result<()> { let value_name = pop_value()?; let key = value_name.to_property_key(); let fc = key.map(|pk| NormalCompletion::from(ECMAScriptValue::from(pk))); push_completion(fc).expect(PUSHABLE); Ok(()) } - pub fn copy_data_props(exclusions: &[PropertyKey]) -> anyhow::Result<()> { + pub(crate) fn copy_data_props(exclusions: &[PropertyKey]) -> anyhow::Result<()> { let value = pop_value()?; let obj = pop_obj()?; let fc = obj.copy_data_properties(value, exclusions).map(|()| NormalCompletion::from(obj)); push_completion(fc).expect(PUSHABLE); Ok(()) } - pub fn copy_data_props_with_exclusions() -> anyhow::Result<()> { + pub(crate) fn copy_data_props_with_exclusions() -> anyhow::Result<()> { let exclusions = pop_key_list()?; copy_data_props(&exclusions) } - pub fn to_string() -> anyhow::Result<()> { + pub(crate) fn to_string() -> anyhow::Result<()> { let val = pop_value()?; let result = super::to_string(val).map(NormalCompletion::from); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn to_numeric() -> anyhow::Result<()> { + pub(crate) fn to_numeric() -> anyhow::Result<()> { let val = pop_value()?; let result = val.to_numeric().map(NormalCompletion::from); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn to_object() -> anyhow::Result<()> { + pub(crate) fn to_object() -> anyhow::Result<()> { let val = pop_value()?; let result = super::to_object(val).map(NormalCompletion::from); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn increment() -> anyhow::Result<()> { + pub(crate) fn increment() -> anyhow::Result<()> { let num = pop_numeric()?; let result_val = match num { Numeric::Number(n) => ECMAScriptValue::Number(n + 1.0), @@ -1869,7 +1873,7 @@ mod insn_impl { push_value(result_val).expect(PUSHABLE); Ok(()) } - pub fn decrement() -> anyhow::Result<()> { + pub(crate) fn decrement() -> anyhow::Result<()> { let num = pop_numeric()?; let result_val = match num { Numeric::Number(n) => ECMAScriptValue::Number(n - 1.0), @@ -1878,37 +1882,37 @@ mod insn_impl { push_value(result_val).expect(PUSHABLE); Ok(()) } - pub fn pre_increment() -> anyhow::Result<()> { + pub(crate) fn pre_increment() -> anyhow::Result<()> { let fc = pop_completion()?; let result = prefix_increment(fc); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn pre_decrement() -> anyhow::Result<()> { + pub(crate) fn pre_decrement() -> anyhow::Result<()> { let fc = pop_completion()?; let result = prefix_decrement(fc); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn delete() -> anyhow::Result<()> { + pub(crate) fn delete() -> anyhow::Result<()> { let fc = pop_completion()?; let result = delete_ref(fc); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn void() -> anyhow::Result<()> { + pub(crate) fn void() -> anyhow::Result<()> { let fc = pop_completion()?; let result = void_operator(fc); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn type_of() -> anyhow::Result<()> { + pub(crate) fn type_of() -> anyhow::Result<()> { let fc = pop_completion()?; let result = typeof_operator(fc); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn append_list() -> anyhow::Result<()> { + pub(crate) fn append_list() -> anyhow::Result<()> { // stack has 2 lists (N itemA(n-1) itemA(n-2) ... itemA(0)) (M itemB(m-1) ... itemB(0)) // This routine combines them into (N+M itemA(n-1) ... itemA(0) itemB(m-1) ... itemB(0)) // call them ListA and ListB ... @@ -1932,7 +1936,7 @@ mod insn_impl { push_completion(Ok((new_len as f64).into())).expect(PUSHABLE); Ok(()) } - pub fn require_constructor() -> anyhow::Result<()> { + pub(crate) fn require_constructor() -> anyhow::Result<()> { let val = pop_value()?; push_completion(if val.is_constructor() { Ok(NormalCompletion::Empty) @@ -1942,7 +1946,7 @@ mod insn_impl { .expect(PUSHABLE); Ok(()) } - pub fn call(strict: bool, tailcall: bool) -> anyhow::Result<()> { + pub(crate) fn call(strict: bool, tailcall: bool) -> anyhow::Result<()> { let arg_count = pop_usize()?; let mut arguments = Vec::with_capacity(arg_count); for _ in 1..=arg_count { @@ -1983,14 +1987,14 @@ mod insn_impl { Ok(()) } - pub fn end_function() -> anyhow::Result<()> { + pub(crate) fn end_function() -> anyhow::Result<()> { let result = pop_completion()?; let f_obj = pop_obj()?; let callable = f_obj.o.to_callable_obj().ok_or(InternalRuntimeError::FunctionExpected)?; callable.end_evaluation(result); Ok(()) } - pub fn construct() -> anyhow::Result<()> { + pub(crate) fn construct() -> anyhow::Result<()> { // Stack: N arg[n-1] arg[n-2] ... arg[0] newtgt cstr let arg_count = pop_usize()?; let mut arguments = Vec::with_capacity(arg_count); @@ -2006,12 +2010,12 @@ mod insn_impl { Ok(()) } - pub fn return_insn() -> anyhow::Result<()> { + pub(crate) fn return_insn() -> anyhow::Result<()> { let value = pop_value()?; push_completion(Err(AbruptCompletion::Return { value })).expect(PUSHABLE); Ok(()) } - pub fn unary_plus() -> anyhow::Result<()> { + pub(crate) fn unary_plus() -> anyhow::Result<()> { let exp = pop_completion()?; let val = super::get_value(exp); let result = match val { @@ -2021,7 +2025,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn unary_minus() -> anyhow::Result<()> { + pub(crate) fn unary_minus() -> anyhow::Result<()> { let exp = pop_completion()?; let val = super::get_value(exp); let old_val = match val { @@ -2036,7 +2040,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn unary_complement() -> anyhow::Result<()> { + pub(crate) fn unary_complement() -> anyhow::Result<()> { let exp = pop_completion()?; let val = super::get_value(exp); let old_val = match val { @@ -2051,7 +2055,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn unary_not() -> anyhow::Result<()> { + pub(crate) fn unary_not() -> anyhow::Result<()> { let exp = pop_completion()?; let val = super::get_value(exp); let result = match val { @@ -2061,14 +2065,17 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn binary_operation(op: BinOp) -> anyhow::Result<()> { + pub(crate) fn binary_operation(op: BinOp) -> anyhow::Result<()> { let right = pop_value()?; let left = pop_value()?; let result = apply_string_or_numeric_binary_operator(left, right, op); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn instantiate_id_free_function_expression(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn instantiate_id_free_function_expression( + chunk: &Rc, + source: &SourceTree, + ) -> anyhow::Result<()> { // The syntax-directed operation InstantiateOrdinaryFunctionExpression takes optional argument name and // returns a function object. It is defined piecewise over the following productions: // @@ -2127,7 +2134,10 @@ mod insn_impl { Ok(()) } - pub fn instantiate_ordinary_function_expression(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn instantiate_ordinary_function_expression( + chunk: &Rc, + source: &SourceTree, + ) -> anyhow::Result<()> { // The syntax-directed operation InstantiateOrdinaryFunctionExpression takes optional argument name // and returns a function object. It is defined piecewise over the following productions: // @@ -2197,7 +2207,7 @@ mod insn_impl { Ok(()) } - pub fn instantiate_arrow_function_expression(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn instantiate_arrow_function_expression(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { let info = sfd_operand(chunk)?; let env = current_lexical_environment().unwrap(); let priv_env = current_private_environment(); @@ -2237,7 +2247,7 @@ mod insn_impl { push_value(closure.into()).expect(PUSHABLE); Ok(()) } - pub fn instantiate_ordinary_function_object(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn instantiate_ordinary_function_object(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { let name = string_operand(chunk)?; let info = sfd_operand(chunk)?; @@ -2277,7 +2287,7 @@ mod insn_impl { push_value(closure.into()).expect(PUSHABLE); Ok(()) } - pub fn instantiate_generator_function_object(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn instantiate_generator_function_object(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { // GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } // 1. Let name be the StringValue of BindingIdentifier. // 2. Let sourceText be the source text matched by GeneratorDeclaration. @@ -2333,7 +2343,7 @@ mod insn_impl { push_value(closure.into()).expect(PUSHABLE); Ok(()) } - pub fn instantiate_generator_method(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn instantiate_generator_method(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { // Input: Operand: function chunk id // Input: Operand: enumerable boolean // Input: Stack: propKey object @@ -2408,13 +2418,13 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn throw() -> anyhow::Result<()> { + pub(crate) fn throw() -> anyhow::Result<()> { // Convert the NormalCompletion::Value on top of the stack into a ThrowCompletion with a matching value let value = pop_value()?; push_completion(Err(AbruptCompletion::Throw { value })).expect(PUSHABLE); Ok(()) } - pub fn compare(swap_args: bool, invert: bool) -> anyhow::Result<()> { + pub(crate) fn compare(swap_args: bool, invert: bool) -> anyhow::Result<()> { fn compare_invert(optb: Option) -> NormalCompletion { NormalCompletion::from(!optb.unwrap_or(true)) } @@ -2430,14 +2440,14 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn instance_of() -> anyhow::Result<()> { + pub(crate) fn instance_of() -> anyhow::Result<()> { let right = pop_value()?; let left = pop_value()?; let result = instanceof_operator(left, &right).map(NormalCompletion::from); push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn in_op() -> anyhow::Result<()> { + pub(crate) fn in_op() -> anyhow::Result<()> { let right = pop_value()?; let left = pop_value()?; let result = match right { @@ -2449,7 +2459,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn equal(invert: bool) -> anyhow::Result<()> { + pub(crate) fn equal(invert: bool) -> anyhow::Result<()> { let compute = if invert { bool::not } else { identity }; let right = pop_value()?; let left = pop_value()?; @@ -2457,7 +2467,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn strict_equal(invert: bool) -> anyhow::Result<()> { + pub(crate) fn strict_equal(invert: bool) -> anyhow::Result<()> { let compute = if invert { bool::not } else { identity }; let right = pop_value()?; let left = pop_value()?; @@ -2465,7 +2475,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn create_unmapped_arguments_object() -> anyhow::Result<()> { + pub(crate) fn create_unmapped_arguments_object() -> anyhow::Result<()> { // Stack should have n arg[n-1] arg[n-2] ... arg[0] ... // Those values are NOT consumed; this function assumes they'll be used again. @@ -2509,7 +2519,7 @@ mod insn_impl { Ok(()) // Stack at exit: AObj N arg[N-1] ... arg[0] ... } - pub fn create_mapped_arguments_object() -> anyhow::Result<()> { + pub(crate) fn create_mapped_arguments_object() -> anyhow::Result<()> { // Input: M arg(m-1) ... arg(0) func // Output: Obj M arg(m-1) ... arg(0) func let length = peek_usize(0)?; @@ -2552,7 +2562,7 @@ mod insn_impl { Ok(()) // Stack at exit: AObj N arg[N-1] ... arg[0] func ... } - pub fn add_mapped_argument(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn add_mapped_argument(chunk: &Rc) -> anyhow::Result<()> { let name = string_operand(chunk)?; let argument_index = usize_operand(chunk)?; // Stack: AObj len ... @@ -2567,7 +2577,7 @@ mod insn_impl { // Stack: AObj len ... Ok(()) } - pub fn handle_empty_break() -> anyhow::Result<()> { + pub(crate) fn handle_empty_break() -> anyhow::Result<()> { let prior_result = pop_completion()?; let new_result = match prior_result { Err(AbruptCompletion::Break { value, target: None }) => match value { @@ -2579,7 +2589,7 @@ mod insn_impl { push_completion(new_result).expect(PUSHABLE); Ok(()) } - pub fn handle_targeted_break(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn handle_targeted_break(chunk: &Rc) -> anyhow::Result<()> { let label = string_operand(chunk)?; let prior_result = pop_completion()?; let new_result = match prior_result { @@ -2589,7 +2599,7 @@ mod insn_impl { push_completion(new_result).expect(PUSHABLE); Ok(()) } - pub fn coalesce_value() -> anyhow::Result<()> { + pub(crate) fn coalesce_value() -> anyhow::Result<()> { // Stack: stmtResult V ... // If stmtResult.[[Value]] is not empty, set V to stmtResult.[[Value]]. let stmt_result = pop_completion()?; @@ -2607,7 +2617,7 @@ mod insn_impl { .expect(PUSHABLE); Ok(()) } - pub fn loop_continues(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn loop_continues(chunk: &Rc) -> anyhow::Result<()> { // 1-argument opcode; takes nothing on stack (but does look at the top item); output is // true or false on the stack. let label_set = string_set_operand(chunk)?; @@ -2625,21 +2635,21 @@ mod insn_impl { push_value(result.into()).expect(PUSHABLE); Ok(()) } - pub fn continue_insn() -> anyhow::Result<()> { + pub(crate) fn continue_insn() -> anyhow::Result<()> { push_completion(Err(AbruptCompletion::Continue { value: NormalCompletion::Empty, target: None })) } - pub fn targeted_continue(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn targeted_continue(chunk: &Rc) -> anyhow::Result<()> { let label = string_operand(chunk)?.clone(); push_completion(Err(AbruptCompletion::Continue { value: NormalCompletion::Empty, target: Some(label) })) } - pub fn break_insn() -> anyhow::Result<()> { + pub(crate) fn break_insn() -> anyhow::Result<()> { push_completion(Err(AbruptCompletion::Break { value: NormalCompletion::Empty, target: None })) } - pub fn targeted_break(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn targeted_break(chunk: &Rc) -> anyhow::Result<()> { let label = string_operand(chunk)?.clone(); push_completion(Err(AbruptCompletion::Break { value: NormalCompletion::Empty, target: Some(label) })) } - pub fn iterator_accumulate() -> anyhow::Result<()> { + pub(crate) fn iterator_accumulate() -> anyhow::Result<()> { let iterable = pop_value()?; let starting_index = pop_value()?; let array = pop_obj()?; @@ -2676,7 +2686,7 @@ mod insn_impl { } Ok(()) } - pub fn iterate_arguments() -> anyhow::Result<()> { + pub(crate) fn iterate_arguments() -> anyhow::Result<()> { // Starts with one item on the stack (an ecmascript value), returns either an error or a stack-based // representation of an argument list (N arg(n-1) ... arg(0)). See // [ArgumentListEvaluation](https://tc39.es/ecma262/#sec-runtime-semantics-argumentlistevaluation) @@ -2731,7 +2741,7 @@ mod insn_impl { } Ok(()) } - pub fn elision_idae() -> anyhow::Result<()> { + pub(crate) fn elision_idae() -> anyhow::Result<()> { // The Elision form of IteratorDestructuringAssignmentEvaluation // Input on stack: // Ouptut on stack: /err @@ -2773,7 +2783,7 @@ mod insn_impl { push_completion(retval).expect(PUSHABLE); Ok(()) } - pub fn embellished_iterator_step() -> anyhow::Result<()> { + pub(crate) fn embellished_iterator_step() -> anyhow::Result<()> { // Input: on stack: an iterator record (ir) // Output: on stack: an output value (v), and the input ir, -or- one error // 1. Let v be undefined. @@ -2819,7 +2829,7 @@ mod insn_impl { } Ok(()) } - pub fn iterator_rest() -> anyhow::Result<()> { + pub(crate) fn iterator_rest() -> anyhow::Result<()> { // Input: one stack argument, an iterator record // Output: two stack elements: an array object, followed by the iterator record // or: one stack element: an error @@ -2876,7 +2886,7 @@ mod insn_impl { } Ok(()) } - pub fn require_coercible() -> anyhow::Result<()> { + pub(crate) fn require_coercible() -> anyhow::Result<()> { // Input: one stack argument, an ECMAScriptValue // Output: one stack completion: either the same input value, or an error. let val = pop_value()?; @@ -2888,7 +2898,7 @@ mod insn_impl { .expect(PUSHABLE); Ok(()) } - pub fn get_sync_iterator() -> anyhow::Result<()> { + pub(crate) fn get_sync_iterator() -> anyhow::Result<()> { // This instruction handles the step that looks like: // 1. Let iteratorRecord be ? GetIterator(value, sync). // @@ -2900,7 +2910,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn iterator_close() -> anyhow::Result<()> { + pub(crate) fn iterator_close() -> anyhow::Result<()> { // This instruction handles the steps that look like: // 1. Return ? IteratorClose(iteratorRecord, status). @@ -2912,7 +2922,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn iterator_close_if_not_done() -> anyhow::Result<()> { + pub(crate) fn iterator_close_if_not_done() -> anyhow::Result<()> { // This instruction handles the step that looks like: // 3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result). // 4. Return ? result. @@ -2926,7 +2936,7 @@ mod insn_impl { push_completion(right).expect(PUSHABLE); Ok(()) } - pub fn iterator_next() -> anyhow::Result<()> { + pub(crate) fn iterator_next() -> anyhow::Result<()> { // This instruction handles the steps that look like: // 1. Let nextResult be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]]). // 2. If nextResult is not an Object, throw a TypeError exception. @@ -2949,7 +2959,7 @@ mod insn_impl { push_completion(result.map(NormalCompletion::from)).expect(PUSHABLE); Ok(()) } - pub fn iterator_result_complete() -> anyhow::Result<()> { + pub(crate) fn iterator_result_complete() -> anyhow::Result<()> { // This instruction handles the steps that look like: // 1. Let done be ? IteratorComplete(nextResult). // @@ -2962,7 +2972,7 @@ mod insn_impl { push_completion(done.map(NormalCompletion::from)).expect(PUSHABLE); Ok(()) } - pub fn iterator_result_to_value() -> anyhow::Result<()> { + pub(crate) fn iterator_result_to_value() -> anyhow::Result<()> { // This instruction handles the steps that look like: // 1. Let nextValue be ? IteratorValue(nextResult). // @@ -2973,7 +2983,7 @@ mod insn_impl { push_completion(value.map(NormalCompletion::from)).expect(PUSHABLE); Ok(()) } - pub fn getv() -> anyhow::Result<()> { + pub(crate) fn getv() -> anyhow::Result<()> { // input: key, base let prop_name = pop_key()?; let base_val = pop_value()?; @@ -2981,7 +2991,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn enumerate_object_properties() -> anyhow::Result<()> { + pub(crate) fn enumerate_object_properties() -> anyhow::Result<()> { // input: an object // output: an iterator record set up to iterate over the properties of that object let obj = pop_obj()?; @@ -2991,7 +3001,7 @@ mod insn_impl { push_completion(Ok(NormalCompletion::from(ir))).expect(PUSHABLE); Ok(()) } - pub fn private_id_lookup(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn private_id_lookup(chunk: &Rc) -> anyhow::Result<()> { // Expect string id in the opcode; it refers to "privateIdentifier" in the following steps: // Input on the stack: nothing // Output on the stack: the sought-after PrivateId @@ -3012,7 +3022,7 @@ mod insn_impl { .clone(); push_completion(Ok(NormalCompletion::from(private_name))) } - pub fn evaluate_initialized_class_field_def( + pub(crate) fn evaluate_initialized_class_field_def( chunk: &Rc, source: &SourceTree, staticness: Static, @@ -3037,7 +3047,7 @@ mod insn_impl { push_completion(Ok(completion)).expect(PUSHABLE); Ok(()) } - pub fn evaluate_class_static_block_def(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn evaluate_class_static_block_def(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { // This does the runtime parts of ClassStaticBlockDefinitionEvaluation // Input Operand: sfd_index // Input Stack: homeObject @@ -3053,7 +3063,7 @@ mod insn_impl { push_completion(Ok(NormalCompletion::ClassItem(block))).expect(PUSHABLE); Ok(()) } - pub fn define_method(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn define_method(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { // on the stack: object prototype let info = sfd_operand(chunk)?; let obj = pop_obj()?; @@ -3100,7 +3110,7 @@ mod insn_impl { Err(InternalRuntimeError::ExpectedMethod)? } } - pub fn set_function_name() -> anyhow::Result<()> { + pub(crate) fn set_function_name() -> anyhow::Result<()> { // on stack: propertykey closure // but at the exit, we want them to stay there, so we just peek them from the end of the stack. let property_key = peek_function_name(0)?; @@ -3108,7 +3118,7 @@ mod insn_impl { super::set_function_name(&closure, property_key, None); Ok(()) } - pub fn define_method_property(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn define_method_property(chunk: &Rc) -> anyhow::Result<()> { // Takes one arg. 0 => enumerable:false; 1 => enumerable:true // Stack: propertykey closure object let enumerable = usize_operand(chunk)? != 0; @@ -3119,7 +3129,7 @@ mod insn_impl { push_completion(result).expect(PUSHABLE); Ok(()) } - pub fn define_getter(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn define_getter(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { // Takes two args: idx into function stash and enumerable flag // stack input: propkey object // output: err/empty/PrivateElement @@ -3192,7 +3202,7 @@ mod insn_impl { push_completion(result.map(NormalCompletion::from)).expect(PUSHABLE); Ok(()) } - pub fn define_setter(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn define_setter(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { // Takes two args: idx into function stash and enumerable flag // stack input: propkey object // output: err/empty/PrivateElement @@ -3265,7 +3275,7 @@ mod insn_impl { push_completion(result.map(NormalCompletion::from)).expect(PUSHABLE); Ok(()) } - pub fn generator_start_from_function(source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn generator_start_from_function(source: &SourceTree) -> anyhow::Result<()> { // 2. Let G be ? OrdinaryCreateFromConstructor(functionObject, // "%GeneratorFunction.prototype.prototype%", « [[GeneratorState]], [[GeneratorContext]], // [[GeneratorBrand]] »). @@ -3278,16 +3288,15 @@ mod insn_impl { push_completion(g_res.clone().map(NormalCompletion::from)).expect(PUSHABLE); if let Ok(g_obj) = g_res.as_ref() { let g = g_obj.o.to_generator_object().ok_or(InternalRuntimeError::GeneratorExpected)?; - g.generator_data.borrow_mut().generator_brand = String::new(); - generator_start_from_function_body( - g_obj, - func.o.to_function_obj().ok_or(InternalRuntimeError::FunctionExpected)?, - source, - ); + g.generator_data.borrow_mut().brand = String::new(); + generator_start_from_function_body(g_obj, source); } Ok(()) } - pub fn instantiate_generator_function_expression(chunk: &Rc, source: &SourceTree) -> anyhow::Result<()> { + pub(crate) fn instantiate_generator_function_expression( + chunk: &Rc, + source: &SourceTree, + ) -> anyhow::Result<()> { let info = sfd_operand(chunk)?; // Runtime Semantics: InstantiateGeneratorFunctionExpression // The syntax-directed operation InstantiateGeneratorFunctionExpression takes optional argument name (a property @@ -3346,7 +3355,7 @@ mod insn_impl { push_value(closure.into()).expect(PUSHABLE); Ok(()) } - pub async fn yield_insn(co: &Co>) -> anyhow::Result<()> { + pub(crate) async fn yield_insn(co: &Co>) -> anyhow::Result<()> { // Yield ( value ) // The abstract operation Yield takes argument value (an ECMAScript language value) and returns either a normal // completion containing an ECMAScript language value or an abrupt completion. It performs the following steps @@ -3361,7 +3370,7 @@ mod insn_impl { push_completion(yielded_result.map(NormalCompletion::from)).expect(PUSHABLE); Ok(()) } - pub fn reg_exp_create(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn reg_exp_create(chunk: &Rc) -> anyhow::Result<()> { let pattern = string_operand(chunk)?; let flags = string_operand(chunk)?; let ro = super::reg_exp_create(ECMAScriptValue::from(pattern), Some(flags.clone())) @@ -3369,7 +3378,7 @@ mod insn_impl { push_completion(Ok(NormalCompletion::from(ro)))?; Ok(()) } - pub fn get_parents_from_superclass() -> anyhow::Result<()> { + pub(crate) fn get_parents_from_superclass() -> anyhow::Result<()> { // Input Stack: err/superclass-reference // Output Stack: err/(proto-parent constructor-parent) @@ -3412,7 +3421,7 @@ mod insn_impl { Ok(()) } - pub fn create_default_constructor() -> anyhow::Result<()> { + pub(crate) fn create_default_constructor() -> anyhow::Result<()> { // Input: Stack: constructorParent className // Output: Stack: constructorFunctionObject let constructor_parent = pop_value()?.try_into()?; @@ -3438,7 +3447,7 @@ mod insn_impl { Ok(()) } - pub fn make_class_constructor_and_set_name() -> anyhow::Result<()> { + pub(crate) fn make_class_constructor_and_set_name() -> anyhow::Result<()> { // Input Stack: functionObject className // Output Stack: functionObject let function_object = pop_value()?.try_into()?; @@ -3451,7 +3460,7 @@ mod insn_impl { Ok(()) } - pub fn make_constructor() -> anyhow::Result<()> { + pub(crate) fn make_constructor() -> anyhow::Result<()> { // Input Stack: func-object // Output Stack: func-object let function_object = pop_value()?.try_into()?; @@ -3460,7 +3469,7 @@ mod insn_impl { Ok(()) } - pub fn make_constructor_with_proto() -> anyhow::Result<()> { + pub(crate) fn make_constructor_with_proto() -> anyhow::Result<()> { // Input Stack: func-object proto // Output Stack: func-object proto let function_object = pop_obj()?; @@ -3471,7 +3480,7 @@ mod insn_impl { Ok(()) } - pub fn set_derived() -> anyhow::Result<()> { + pub(crate) fn set_derived() -> anyhow::Result<()> { // Input Stack: func-object // Output Stack: func-object let function_object: Object = pop_obj()?; @@ -3491,7 +3500,7 @@ mod insn_impl { Ok(()) } - pub fn attach_elements(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn attach_elements(chunk: &Rc) -> anyhow::Result<()> { // Input: Operand: count: the number of elements to process; count can be zero // Input: Stack: FunctionObject element1 element2 ... elementN // Output: Stack: err/FunctionObject @@ -3622,7 +3631,7 @@ mod insn_impl { } } - pub fn attach_source_text(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn attach_source_text(chunk: &Rc) -> anyhow::Result<()> { // Input: operand: string // Input stack: obj // Output stack: obj @@ -3645,7 +3654,7 @@ mod insn_impl { Ok(()) } - pub fn name_only_field_record(staticness: Static) -> anyhow::Result<()> { + pub(crate) fn name_only_field_record(staticness: Static) -> anyhow::Result<()> { // Input: Stack: name (which is a string, symbol, or private name) // Output: Stack: fieldRecord let name = pop_classname()?.ok_or(InternalRuntimeError::ClassNameExpected)?; @@ -3659,7 +3668,7 @@ mod insn_impl { Ok(()) } - pub fn make_private_reference(chunk: &Rc) -> anyhow::Result<()> { + pub(crate) fn make_private_reference(chunk: &Rc) -> anyhow::Result<()> { // Input: operand : string index // Input: Stack: baseValue // Output: Stack: privateReference @@ -3671,7 +3680,7 @@ mod insn_impl { Ok(()) } - pub fn get_new_target() -> anyhow::Result<()> { + pub(crate) fn get_new_target() -> anyhow::Result<()> { // Input: nothing // Output: Stack: newTarget let nt = super::get_new_target()?; @@ -3682,13 +3691,13 @@ mod insn_impl { push_value(val) } - pub fn get_super_constructor() -> anyhow::Result<()> { + pub(crate) fn get_super_constructor() -> anyhow::Result<()> { // Input: nothing // Output Stack: func push_value(super::get_super_constructor()?) } - pub fn constructor_check() -> anyhow::Result<()> { + pub(crate) fn constructor_check() -> anyhow::Result<()> { // Input: value // Output: err/value let value = pop_value()?; @@ -3700,7 +3709,7 @@ mod insn_impl { Ok(()) } - pub fn bind_this_and_init() -> anyhow::Result<()> { + pub(crate) fn bind_this_and_init() -> anyhow::Result<()> { // 7. Let thisER be GetThisEnvironment(). // 8. Perform ? thisER.BindThisValue(result). // 9. Let F be thisER.[[FunctionObject]]. @@ -3727,7 +3736,7 @@ mod insn_impl { Ok(()) } - pub fn static_class_item() -> anyhow::Result<()> { + pub(crate) fn static_class_item() -> anyhow::Result<()> { // Take what's on top of the stack and transform it to a static class item // Input: empty/classitem/privatelement/err @@ -3765,14 +3774,14 @@ mod insn_impl { } } -pub fn execute_synchronously(source: &SourceTree) -> Completion { +pub(crate) fn execute_synchronously(source: &SourceTree) -> Completion { match Gen::new(|co| execute(co, source.clone())).resume_with(Ok(ECMAScriptValue::Undefined)) { genawaiter::GeneratorState::Yielded(val) => panic!("Yielded from synchronous context with value {val}"), genawaiter::GeneratorState::Complete(val) => val, } } -pub async fn execute( +pub(crate) async fn execute( co: Co>, source: SourceTree, ) -> Completion { @@ -4474,7 +4483,7 @@ fn define_method_property( } impl ECMAScriptValue { - pub fn is_less_than(&self, other: &ECMAScriptValue, self_first: bool) -> Completion> { + pub(crate) fn is_less_than(&self, other: &ECMAScriptValue, self_first: bool) -> Completion> { let (px, py) = if self_first { let px = self.to_primitive(None)?; let py = other.to_primitive(None)?; @@ -4544,7 +4553,7 @@ impl ECMAScriptValue { } } -pub fn instanceof_operator(v: ECMAScriptValue, target: &ECMAScriptValue) -> Completion { +pub(crate) fn instanceof_operator(v: ECMAScriptValue, target: &ECMAScriptValue) -> Completion { // InstanceofOperator ( V, target ) // // The abstract operation InstanceofOperator takes arguments V (an ECMAScript language value) and target (an @@ -4603,7 +4612,7 @@ enum BinOp { } #[derive(Debug, PartialEq, Eq, Copy, Clone)] -pub enum WksId { +pub(crate) enum WksId { AsyncIterator, HasInstance, IsConcatSpreadable, @@ -4620,35 +4629,35 @@ pub enum WksId { } #[derive(Debug)] -pub struct WellKnownSymbols { - pub async_iterator_: Symbol, - pub has_instance_: Symbol, - pub is_concat_spreadable_: Symbol, - pub iterator_: Symbol, - pub match_: Symbol, - pub match_all_: Symbol, - pub replace_: Symbol, - pub search_: Symbol, - pub species_: Symbol, - pub split_: Symbol, - pub to_primitive_: Symbol, - pub to_string_tag_: Symbol, - pub unscopables_: Symbol, +pub(crate) struct WellKnownSymbols { + pub(crate) async_iterator: Symbol, + pub(crate) has_instance: Symbol, + pub(crate) is_concat_spreadable: Symbol, + pub(crate) iterator: Symbol, + pub(crate) match_: Symbol, + pub(crate) match_all: Symbol, + pub(crate) replace: Symbol, + pub(crate) search: Symbol, + pub(crate) species: Symbol, + pub(crate) split: Symbol, + pub(crate) to_primitive: Symbol, + pub(crate) to_string_tag: Symbol, + pub(crate) unscopables: Symbol, } #[derive(Debug, Clone)] -pub struct SourceTree { - pub ast: ParsedText, - pub text: String, +pub(crate) struct SourceTree { + pub(crate) ast: ParsedText, + pub(crate) text: String, } impl SourceTree { - pub fn empty() -> Self { + pub(crate) fn empty() -> Self { SourceTree { ast: ParsedText::Empty, text: String::new() } } } -pub fn parse_script(source_text: &str, realm: Rc>) -> Result> { +pub(crate) fn parse_script(source_text: &str, realm: Rc>) -> Result> { let ast = parse_text(source_text, ParseGoal::Script, false, false); let script: Result, Vec> = ast .clone() @@ -4678,14 +4687,14 @@ impl TryFrom for TopLevelLexDecl { type Error = anyhow::Error; fn try_from(src: DeclPart) -> anyhow::Result { match src { - DeclPart::ClassDeclaration(cd) => Ok(Self::Class(cd)), - DeclPart::LexicalDeclaration(ld) => Ok(Self::Lex(ld)), + DeclPart::Class(cd) => Ok(Self::Class(cd)), + DeclPart::Lexical(ld) => Ok(Self::Lex(ld)), _ => Err(anyhow!("Not a top-level lexical decl")), } } } #[derive(Debug, Clone)] -pub enum FcnDef { +pub(crate) enum FcnDef { Function(Rc), Generator(Rc), AsyncFun(Rc), @@ -4708,16 +4717,16 @@ impl TryFrom for FcnDef { type Error = anyhow::Error; fn try_from(value: DeclPart) -> anyhow::Result { match value { - DeclPart::FunctionDeclaration(fd) => Ok(Self::Function(fd)), - DeclPart::GeneratorDeclaration(gd) => Ok(Self::Generator(gd)), - DeclPart::AsyncFunctionDeclaration(afd) => Ok(Self::AsyncFun(afd)), - DeclPart::AsyncGeneratorDeclaration(agd) => Ok(Self::AsyncGen(agd)), - DeclPart::ClassDeclaration(_) | DeclPart::LexicalDeclaration(_) => Err(anyhow!("Not a function def")), + DeclPart::Function(fd) => Ok(Self::Function(fd)), + DeclPart::Generator(gd) => Ok(Self::Generator(gd)), + DeclPart::AsyncFunction(afd) => Ok(Self::AsyncFun(afd)), + DeclPart::AsyncGenerator(agd) => Ok(Self::AsyncGen(agd)), + DeclPart::Class(_) | DeclPart::Lexical(_) => Err(anyhow!("Not a function def")), } } } impl FcnDef { - pub fn bound_name(&self) -> JSString { + pub(crate) fn bound_name(&self) -> JSString { match self { FcnDef::Function(x) => x.bound_name(), FcnDef::Generator(x) => x.bound_name(), @@ -4725,7 +4734,7 @@ impl FcnDef { FcnDef::AsyncGen(x) => x.bound_name(), } } - pub fn instantiate_function_object( + pub(crate) fn instantiate_function_object( &self, env: Rc, private_env: Option>>, @@ -4767,7 +4776,7 @@ impl TryFrom for TopLevelVarDecl { } } -pub fn global_declaration_instantiation( +pub(crate) fn global_declaration_instantiation( script: &Rc