This Pull Request closes#1975. It's still a work in progress, but tries to go in that direction.
It changes the following:
- Adds a new `TryFromJs` trait, that can be derived using a new `boa_derive` crate.
- Adds a new `try_js_into()` function that, similarly to the standard library `TryInto` trait
Things to think about:
- Should the `boa_derive` crate be re-exported in `boa_engine` using a `derive` feature, similar to how it's done in `serde`?
- The current implementation only converts perfectly valid values. So, if we try to convert a big integer into an `i8`, or any floating point number to an `f32`. So, you cannot derive `TryFromJs` for structures that contain an `f32` for example (you can still manually implement the trait, though, and decide in favour of a loss of precision). Should we also provide some traits for transparent loss of precision?
- Currently, you cannot convert between types, so if the JS struct has an integer, you cannot cast it to a boolean, for example. Should we provide a `TryConvertJs` trait, for example to force conversions?
- Currently we only have basic types and object conversions. Should add `Array` to `Vec` conversion, for example, right? Should we also add `TypedArray` conversions? What about `Map` and `Set`? Does this step over the fine grained APIs that we were creating?
Note that this still requires a bunch of documentation, tests, and validation from the dev team and from the users that requested this feature. I'm particularly interested in @lastmjs's thoughts on this API.
I already added an usage example in `boa_examples/src/bin/derive.rs`.
Co-authored-by: jedel1043 <jedel0124@gmail.com>
Bumps [synstructure](https://github.com/mystor/synstructure) from 0.12.6 to 0.13.0.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/mystor/synstructure/commits">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=synstructure&package-manager=cargo&previous-version=0.12.6&new-version=0.13.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Co-authored-by: jedel1043 <jedel0124@gmail.com>
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.10 to 2.0.11.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>2.0.11</h2>
<ul>
<li>Improve error message on empty parens inside parse_nested_meta (<a href="https://redirect.github.com/dtolnay/syn/issues/1428">#1428</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="c58aceb0b1"><code>c58aceb</code></a> Release 2.0.11</li>
<li><a href="161be5acec"><code>161be5a</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1428">#1428</a> from dtolnay/emptyattr</li>
<li><a href="0b7da9641c"><code>0b7da96</code></a> Improve error message on empty parens inside parse_nested_meta</li>
<li><a href="02961800aa"><code>0296180</code></a> Update test suite to nightly-2023-03-28</li>
<li><a href="e19a0fbfe1"><code>e19a0fb</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1425">#1425</a> from dtolnay/alert</li>
<li><a href="dffe82b26e"><code>dffe82b</code></a> Perform build-time alerts in test suite using build-alert crate</li>
<li><a href="85d086ff09"><code>85d086f</code></a> Expose a way to fuzz with span-locations</li>
<li><a href="741f67ec4b"><code>741f67e</code></a> Update fuzz crate gitignore to ignore coverage dir</li>
<li><a href="f954499c76"><code>f954499</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1423">#1423</a> from dtolnay/codegen</li>
<li><a href="efe6fcbef4"><code>efe6fcb</code></a> Revert "Decouple current syntax tree from the one codegen uses"</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/syn/compare/2.0.10...2.0.11">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=2.0.10&new-version=2.0.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.8 to 2.0.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>2.0.10</h2>
<ul>
<li>Fix visibility being parsed incorrectly on macro invocations inside of a trait</li>
</ul>
<h2>2.0.9</h2>
<ul>
<li>Disallow <code>type</code> items in an extern block, trait, or module from being marked <code>default</code></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="c4976f19f0"><code>c4976f1</code></a> Release 2.0.10</li>
<li><a href="1f705d8ec6"><code>1f705d8</code></a> Remove precedence logic for the removed type ascription expression</li>
<li><a href="64ed2b1b19"><code>64ed2b1</code></a> Disallow visibility and defaultness on macro call in trait item position</li>
<li><a href="a33ffa388a"><code>a33ffa3</code></a> Fix parsing of const, async, unsafe, and extern fns inside impl block</li>
<li><a href="94439aae5f"><code>94439aa</code></a> Restore lookahead peek for better error message</li>
<li><a href="275d368069"><code>275d368</code></a> Release 2.0.9</li>
<li><a href="280d5e478d"><code>280d5e4</code></a> Remove dead code from ImplItemFn's ToTokens</li>
<li><a href="5036fd9c6e"><code>5036fd9</code></a> Clean up ImplItemFn hack using ImplItem::Verbatim</li>
<li><a href="0f99d27656"><code>0f99d27</code></a> Factor out some common code for type parsing</li>
<li><a href="fd8d37ee5c"><code>fd8d37e</code></a> Disallow some nonsensical configurations of items</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/syn/compare/2.0.8...2.0.10">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=2.0.8&new-version=2.0.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.3 to 2.0.8.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>2.0.8</h2>
<ul>
<li>Treat <code>try</code> keyword as 2015-edition identifier in definition of try macro (<a href="https://redirect.github.com/dtolnay/syn/issues/1422">#1422</a>)</li>
</ul>
<h2>2.0.7</h2>
<ul>
<li>Fix parsing of <code>mut self</code> inside of Type::BareFn</li>
</ul>
<h2>2.0.6</h2>
<ul>
<li>Improve error message on missing ';' between statements (<a href="https://redirect.github.com/dtolnay/syn/issues/1419">#1419</a>)</li>
<li>Keep non-brace macro invocations in trailing expr position as Expr::Macro (<a href="https://redirect.github.com/dtolnay/syn/issues/1420">#1420</a>)</li>
</ul>
<h2>2.0.5</h2>
<ul>
<li>Expose <code>ExprMacro</code> data structure even when <code>features="full"</code> is not used (<a href="https://redirect.github.com/dtolnay/syn/issues/1417">#1417</a>)</li>
</ul>
<h2>2.0.4</h2>
<ul>
<li>Improve error reporting when parsing identifiers and paths (<a href="https://redirect.github.com/dtolnay/syn/issues/1415">#1415</a>, <a href="https://redirect.github.com/dtolnay/syn/issues/1416">#1416</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="2fea56f57a"><code>2fea56f</code></a> Release 2.0.8</li>
<li><a href="40aa291011"><code>40aa291</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1422">#1422</a> from dtolnay/trymacro</li>
<li><a href="f3a4a4c0c1"><code>f3a4a4c</code></a> Treat try keyword as 2015 ident in definition of try macro</li>
<li><a href="b862eff8aa"><code>b862eff</code></a> Release 2.0.7</li>
<li><a href="e6b1bdfc29"><code>e6b1bdf</code></a> Disallow consecutive path separator in use paths</li>
<li><a href="8ae37b75d6"><code>8ae37b7</code></a> Fix duplicated name of mut self bare fn arg</li>
<li><a href="78401020ba"><code>7840102</code></a> Release 2.0.6</li>
<li><a href="e76d6441fd"><code>e76d644</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1420">#1420</a> from dtolnay/nonbracemacro</li>
<li><a href="6dcc48070f"><code>6dcc480</code></a> Keep non-brace macro invocations in trailing expr position as Expr::Macro</li>
<li><a href="d12db40c49"><code>d12db40</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/syn/issues/1419">#1419</a> from dtolnay/expectedsemi</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/syn/compare/2.0.3...2.0.8">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=2.0.3&new-version=2.0.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel necessary.
--->
This Pull Request fixes/closes #2700. It updates the `syn` dependency to v2.
I had to activate the "full" feature in order to make have the tuple elements available in `boa_macros/src/lib.rs` line 81. Maybe we could look for a different way of doing this (didn't spend time on it), to avoid activating all features of `syn`.
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.25 to 1.0.26.
<details>
<summary>Commits</summary>
<ul>
<li><a href="ca98b6594a"><code>ca98b65</code></a> Release 1.0.26</li>
<li><a href="bf9bca9668"><code>bf9bca9</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/quote/issues/247">#247</a> from dtolnay/wrongspan</li>
<li><a href="d67f6ffb80"><code>d67f6ff</code></a> Ignore intentional unused_self pedantic clippy lint</li>
<li><a href="8931b2a8b4"><code>8931b2a</code></a> Improve error message on incorrectly typed span</li>
<li><a href="51bb1e7e9e"><code>51bb1e7</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/quote/issues/246">#246</a> from dtolnay/spaninfer</li>
<li><a href="f3f7140ee2"><code>f3f7140</code></a> Fix compatibility with rustc pre-1.46</li>
<li><a href="76b38b23de"><code>76b38b2</code></a> Alternative approach with private types</li>
<li><a href="3eb1954293"><code>3eb1954</code></a> Help span argument of quote_spanned get inferred to Span</li>
<li>See full diff in <a href="https://github.com/dtolnay/quote/compare/1.0.25...1.0.26">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=quote&package-manager=cargo&previous-version=1.0.25&new-version=1.0.26)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.23 to 1.0.25.
<details>
<summary>Commits</summary>
<ul>
<li><a href="91dfd00412"><code>91dfd00</code></a> Release 1.0.25</li>
<li><a href="d9f38b52b5"><code>d9f38b5</code></a> Add a ui test with ambiguous quote_spanned span</li>
<li><a href="364f021939"><code>364f021</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/quote/issues/239">#239</a> from dtolnay/quotespanned</li>
<li><a href="7f1119f992"><code>7f1119f</code></a> Generalize quote_spanned to accept DelimSpan as span</li>
<li><a href="e8930ae866"><code>e8930ae</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/quote/issues/238">#238</a> from dtolnay/pubuse</li>
<li><a href="98661253b9"><code>9866125</code></a> Split wildcard re-export in runtime module into private and public</li>
<li><a href="5c776cb030"><code>5c776cb</code></a> Release 1.0.24</li>
<li><a href="3967c87e3d"><code>3967c87</code></a> Add another non-public comment on Spanned trait</li>
<li><a href="cd7c205dcb"><code>cd7c205</code></a> Seal the private api Spanned trait</li>
<li><a href="d8551a930d"><code>d8551a9</code></a> Merge pull request <a href="https://redirect.github.com/dtolnay/quote/issues/237">#237</a> from dtolnay/delim</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/quote/compare/1.0.23...1.0.25">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=quote&package-manager=cargo&previous-version=1.0.23&new-version=1.0.25)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.108 to 1.0.109.
<details>
<summary>Commits</summary>
<ul>
<li><a href="bfa790b8e4"><code>bfa790b</code></a> Release 1.0.109</li>
<li><a href="c182545939"><code>c182545</code></a> Restore compatibility with rust 1.31</li>
<li>See full diff in <a href="https://github.com/dtolnay/syn/compare/1.0.108...1.0.109">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=1.0.108&new-version=1.0.109)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.107 to 1.0.108.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>1.0.108</h2>
<ul>
<li>Fix handling of unusual whitespace after escaped newlines in <code>LitStr::value</code> (<a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1381">#1381</a>, thanks <a href="https://github.com/ModProg"><code>@ModProg</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="01f69e937c"><code>01f69e9</code></a> Release 1.0.108</li>
<li><a href="62d0aeda48"><code>62d0aed</code></a> stricter parsing of string_continue escapes</li>
<li>See full diff in <a href="https://github.com/dtolnay/syn/compare/1.0.107...1.0.108">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=1.0.107&new-version=1.0.108)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
I'm creating this draft PR, since I wanted to have some early feedback, and because I though I would have time to finish it last week, but I got caught up with other stuff. Feel free to contribute :)
The main thing here is that I have divided `eval()`, `parse()` and similar functions so that they can decide if they are parsing scripts or modules. Let me know your thoughts.
Then, I was checking the import & export parsing, and I noticed we are using `TokenKind::Identifier` for `IdentifierName`, so I changed that name. An `Identifier` is an `IdentifierName` that isn't a `ReservedWord`. This means we should probably also adapt all `IdentifierReference`, `BindingIdentifier` and so on parsing. I already created an `Identifier` parser.
Something interesting there is that `await` is not a valid `Identifier` if the goal symbol is `Module`, as you can see in the [spec](https://tc39.es/ecma262/#prod-LabelIdentifier), but currently we don't have that information in the `InputElement` enumeration, we only have `Div`, `RegExp` and `TemplateTail`. How could we approach this?
Co-authored-by: jedel1043 <jedel0124@gmail.com>
Another change extracted from #2411.
This PR changes the following:
- Improves our identifier parsing with a new `Identifier` parser that unifies parsing for `IdentifierReference`, `BindingIdentifier` and `LabelIdentifier`.
- Slightly improves some error messages.
- Extracts our manual initialization of static `Sym`s with a new `static_syms` proc macro.
- Adds `set_module_mode` and `module_mode` to the cursor to prepare for modules.
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel necessary.
--->
This Pull Request enables support for `no_std` targets on some of our sub-crates. I intentionally left out `boa_ast` and `boa_cli` because they're the largest crates we have after `boa_engine`.
`boa_gc` is a monster on its own, because we'll need to design a `no_std` multithreaded GC.
Anyways, this changes the following:
- Adds support for `no_std` on `boa_unicode`.
- Adds support for `no_std` on `boa_profiler`.
- Adds support for `no_std` on `boa_interner`.
- Adds support for `no_std` on `boa_icu_provider`.
This PR changes the following:
- Modifies `EphemeronBox` to be more akin to `GcBox`, with its own header, roots and markers. This also makes it more similar to [Racket's](https://docs.racket-lang.org/reference/ephemerons.html) implementation.
- Removes `EPHEMERON_QUEUE`.
- Ephemerons are now tracked on a special `weak_start` linked list, instead of `strong_start` which is where all other GC boxes live.
- Documents all unsafe blocks.
- Documents our current garbage collection algorithm. I hope this'll clarify a bit what exactly are we doing on every garbage collection.
- Renames/removes some functions.
Per the [Standard Library development guide](https://std-dev-guide.rust-lang.org/code-considerations/performance/inline.html):
> You can add `#[inline]`:
>
> - To public, small, non-generic functions.
>
> You shouldn't need `#[inline]`:
> - On methods that have any generics in scope.
> - On methods on traits that don't have a default implementation.
>
> `#[inline]` can always be introduced later, so if you're in doubt they can just be removed.
This PR follows this guideline to reduce the number of `#[inline]` annotations in our code, removing the annotation in:
- Non-public functions
- Generic functions
- Medium and big functions.
Hopefully this shouldn't impact our perf at all, but let's wait to see the benchmark results.
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.105 to 1.0.107.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>1.0.106</h2>
<ul>
<li>Documentation improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/dtolnay/syn/commits">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=1.0.105&new-version=1.0.107)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.21 to 1.0.23.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/quote/releases">quote's releases</a>.</em></p>
<blockquote>
<h2>1.0.22</h2>
<ul>
<li>Documentation improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="550af67f9e"><code>550af67</code></a> Release 1.0.23</li>
<li><a href="b0337d0c55"><code>b0337d0</code></a> Opt out -Zrustdoc-scrape-examples on docs.rs</li>
<li><a href="2386c5a11e"><code>2386c5a</code></a> Release 1.0.22</li>
<li><a href="ead304a8b5"><code>ead304a</code></a> Update build status badge</li>
<li><a href="51d3bd2fa2"><code>51d3bd2</code></a> Update ui test suite to nightly-2022-12-15</li>
<li><a href="2922a8ec2f"><code>2922a8e</code></a> Time out workflows after 45 minutes</li>
<li><a href="6f42f3cac4"><code>6f42f3c</code></a> Fix renamed let_underscore_drop lint</li>
<li><a href="b2e30cc11d"><code>b2e30cc</code></a> MIT copyright line</li>
<li><a href="efc9b69178"><code>efc9b69</code></a> Ui test changes for trybuild 1.0.66</li>
<li><a href="1e2b19847e"><code>1e2b198</code></a> Raise minimum tested toolchain to rust 1.56</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/quote/compare/1.0.21...1.0.23">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=quote&package-manager=cargo&previous-version=1.0.21&new-version=1.0.23)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel necessary.
--->
Submitting this as a draft for feedback/second opinions. This draft contains some changes to the documentation.
Quick Overview:
- Potential `Boa` header for Boa's crates added to `boa_engine`.
- Changes the wording to a lot of module headers (See `builtins` module and `object/builtins` module).
- Updating built-in wrapper's code examples to use `?` operator.
- Adds the doc logo URL to a few crates that didn't have it.
The main idea of this draft is to move away from the "This module implements" wording as it feels a bit duplicative when listed under the Modules section (mainly focusing around changes in `boa_engine` to start).
While working on this, I had a question about whether we should be using JavaScript or ECMAScript in the Boa's documentation. We do seem to currently use both, and this draft uses JavaScript heavily in the wording.
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.104 to 1.0.105.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>1.0.105</h2>
<ul>
<li>Improve parse errors related to <code>dyn</code> and <code>impl</code> type syntax (<a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1245">#1245</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="998e86375b"><code>998e863</code></a> Release 1.0.105</li>
<li><a href="02e2a2190b"><code>02e2a21</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1247">#1247</a> from dtolnay/punctdrop</li>
<li><a href="9113ad0887"><code>9113ad0</code></a> Help infer may_dangle on type parameter of Punctuated iterator Drop impls</li>
<li><a href="3eaa443c3a"><code>3eaa443</code></a> Add regression test for issue 1246</li>
<li><a href="17f9a5c566"><code>17f9a5c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1245">#1245</a> from dtolnay/bounds</li>
<li><a href="db874ddf9b"><code>db874dd</code></a> Improve dyn/impl-related parse errors</li>
<li><a href="b8b0761cb8"><code>b8b0761</code></a> Move TypeParamBound parse loop to associated function</li>
<li><a href="3e915e5c98"><code>3e915e5</code></a> Clean up naming in rustc syntax tree manipulation</li>
<li><a href="ecacc475dd"><code>ecacc47</code></a> Import token::Lit now there's no conflict with MetaItemLit</li>
<li><a href="2647b2a189"><code>2647b2a</code></a> Update test suite to nightly-2022-11-29</li>
<li>See full diff in <a href="https://github.com/dtolnay/syn/compare/1.0.104...1.0.105">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=1.0.104&new-version=1.0.105)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.103 to 1.0.104.
<details>
<summary>Commits</summary>
<ul>
<li><a href="78fa618e96"><code>78fa618</code></a> Release 1.0.104</li>
<li><a href="e054b03a3b"><code>e054b03</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1244">#1244</a> from dtolnay/isnone</li>
<li><a href="3a0406db04"><code>3a0406d</code></a> Make PathArguments::is_none() public</li>
<li><a href="ac1dbf5d85"><code>ac1dbf5</code></a> Time out workflows after 45 minutes</li>
<li><a href="f510eb0ba9"><code>f510eb0</code></a> Update test suite to nightly-2022-11-25</li>
<li><a href="20087fc51c"><code>20087fc</code></a> Update test suite to nightly-2022-11-24</li>
<li><a href="dbc86fe1ed"><code>dbc86fe</code></a> Suppress "emit":"dep-info" json from syn-test-suite-feature-check</li>
<li><a href="1e8227295e"><code>1e82272</code></a> Fix renamed let_underscore_drop lint</li>
<li><a href="754236dbe6"><code>754236d</code></a> Update test suite to nightly-2022-11-23</li>
<li><a href="4245c41f22"><code>4245c41</code></a> Update test suite to nightly-2022-11-19</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/syn/compare/1.0.103...1.0.104">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=1.0.103&new-version=1.0.104)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
This Pull Request restructures the lint deny/warn/allow lists in almost all crates. `boa_engine` will be done in a follow up PR as the changes there are pretty extensive.
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel necessary.
--->
Not sure if anyone else may be working on something more substantial/in-depth, but I thought I'd post this. 😄
The basic rundown is that this is more of an untested (and in some ways naïve) draft than anything else. It builds rather heavily on `rust-gc`, and tries to keep plenty of the core aspects so as to not break anything too much, and also to minimize overarching changes were it to actually be merged at some point.
This implementation does add ~~a generational divide (although a little unoptimized) to the heap,~~ a GcAlloc/Collector struct with methods, and an ephemeron implementation that allows for the WeakPair and WeakGc pointers.
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.102 to 1.0.103.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/syn/releases">syn's releases</a>.</em></p>
<blockquote>
<h2>1.0.103</h2>
<ul>
<li>Implement <code>PartialOrd</code> for <code>Cursor</code> (<a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1236">#1236</a>, <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1237">#1237</a>, thanks <a href="https://github.com/CAD97"><code>@CAD97</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="c29c2abf1b"><code>c29c2ab</code></a> Release 1.0.103</li>
<li><a href="8e81cad736"><code>8e81cad</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1237">#1237</a> from dtolnay/partialord</li>
<li><a href="8db5adbb2b"><code>8db5adb</code></a> Ignore cast_possible_wrap pedantic clippy lint</li>
<li><a href="f6f7d8a6b3"><code>f6f7d8a</code></a> Restrict PartialOrd comparison to only tokens in the same buffer</li>
<li><a href="8dd9b01c58"><code>8dd9b01</code></a> Touch up PR 1236</li>
<li><a href="2b3f742696"><code>2b3f742</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/syn/issues/1236">#1236</a> from CAD97/cursor-cmp</li>
<li><a href="f6a43aa4d6"><code>f6a43aa</code></a> Handle the case where verbatim enters a None group</li>
<li><a href="e9fb6a9ea5"><code>e9fb6a9</code></a> Implement PartialOrd for Cursor</li>
<li><a href="26a605e565"><code>26a605e</code></a> Add test for Item::Verbatim splitting a None group</li>
<li><a href="a807b16011"><code>a807b16</code></a> Update test suite to nightly-2022-10-13</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/syn/compare/1.0.102...1.0.103">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=syn&package-manager=cargo&previous-version=1.0.102&new-version=1.0.103)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
I think it's time to address the elephant in the room.
This Pull Request will (hopefully!) solve part of #736.
This is a complete rewrite of `JsString`, but instead of storing `u8` bytes it stores `u16` words. The `encode!` macro (renamed to `utf16!` for simplicity) from the `const-utf16` crate allows us to create UTF-16 encoded arrays at compilation time. `JsString` implements `Deref<Target=[u16]>` to unlock the slice methods and possibly make some manipulations easier. However, we would need to create our own library of utilities for `JsString`.