Bumps [dyn-clone](https://github.com/dtolnay/dyn-clone) from 1.0.9 to 1.0.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/dyn-clone/releases">dyn-clone's releases</a>.</em></p>
<blockquote>
<h2>1.0.10</h2>
<ul>
<li>Documentation improvements</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="bba3d29def"><code>bba3d29</code></a> Release 1.0.10</li>
<li><a href="dd33dfe106"><code>dd33dfe</code></a> Update build status badge</li>
<li><a href="8f11359eeb"><code>8f11359</code></a> Time out workflows after 45 minutes</li>
<li><a href="4fde3743b1"><code>4fde374</code></a> MIT copyright line</li>
<li><a href="9d4da26691"><code>9d4da26</code></a> Ui test changes for trybuild 1.0.66</li>
<li><a href="1caba5bc65"><code>1caba5b</code></a> Avoid cargo 1.43–1.45 in GitHub Actions</li>
<li><a href="fe54db8b3a"><code>fe54db8</code></a> Add a CI check build on lowest supported compiler</li>
<li><a href="8ff359df96"><code>8ff359d</code></a> Raise minimum tested toolchain to rust 1.56</li>
<li><a href="e7636b5cfc"><code>e7636b5</code></a> Remove default package.readme metadata from Cargo.toml</li>
<li><a href="44d1878326"><code>44d1878</code></a> GitHub Workflows security hardening</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/dyn-clone/compare/1.0.9...1.0.10">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dyn-clone&package-manager=cargo&previous-version=1.0.9&new-version=1.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>
This Pull Request is currently unfinished but will fix/close #1808 after some review and more work
It changes the following:
- Divides byte compiler logic into separate files
I would like some review on the current code I have to know if the patterns I'm using are acceptable for the codebase, if everything looks good I will try to separate more code into different small modules to finish the work here.
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.149 to 1.0.150.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p>
<blockquote>
<h2>v1.0.150</h2>
<ul>
<li>Relax some trait bounds from the <code>Serialize</code> impl of <code>HashMap</code> and <code>BTreeMap</code> (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2334">#2334</a>)</li>
<li>Enable <code>Serialize</code> and <code>Deserialize</code> impls of <code>std::sync::atomic</code> types on more platforms (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2337">#2337</a>, thanks <a href="https://github.com/badboy"><code>@badboy</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="d493649f52"><code>d493649</code></a> Release 1.0.150</li>
<li><a href="0e947e6c3b"><code>0e947e6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2338">#2338</a> from serde-rs/atomic</li>
<li><a href="9249dab54c"><code>9249dab</code></a> Deduplicate atomic_impl macro calls</li>
<li><a href="7440e56c53"><code>7440e56</code></a> Deduplicate atomic_impl macro implementations</li>
<li><a href="0d79306285"><code>0d79306</code></a> Update atomic_impl macros to have same input syntax in all cfgs</li>
<li><a href="37faaf295e"><code>37faaf2</code></a> Mention target_has_atomic stabilization</li>
<li><a href="650358fa00"><code>650358f</code></a> Replace obsolete comment about target_has_atomic support</li>
<li><a href="6159ead404"><code>6159ead</code></a> Invert use_target_has_atomic cfg</li>
<li><a href="692ac99c69"><code>692ac99</code></a> Format PR 2337 with rustfmt</li>
<li><a href="86161ce15f"><code>86161ce</code></a> Adjust spacing in some macro matchers</li>
<li>Additional commits viewable in <a href="https://github.com/serde-rs/serde/compare/v1.0.149...v1.0.150">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.149&new-version=1.0.150)](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 [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p>
<blockquote>
<h2>v1.0.149</h2>
<ul>
<li>Relax some trait bounds from the <code>Serialize</code> impl of <code>BinaryHeap</code>, <code>BTreeSet</code>, and <code>HashSet</code> (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2333">#2333</a>, thanks <a href="https://github.com/jonasbb"><code>@jonasbb</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="0353354d61"><code>0353354</code></a> Release 1.0.149</li>
<li><a href="34ae0422f4"><code>34ae042</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2333">#2333</a> from jonasbb/remove-trait-bounds</li>
<li><a href="cc128feb4c"><code>cc128fe</code></a> Remove some Serialize trait bounds</li>
<li>See full diff in <a href="https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.148&new-version=1.0.149)](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.
This Pull Request changes the following:
- Remove false early error when a class expression was missing a binding identifier.
- Simplify/fix environment truncation on function returns.
The new failed tests where false positives before that will be fixed in another PR.
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.147 to 1.0.148.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/serde/releases">serde's releases</a>.</em></p>
<blockquote>
<h2>v1.0.148</h2>
<ul>
<li>Support <code>remote</code> derive for generic types that have private fields (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2327">#2327</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="7766103174"><code>7766103</code></a> Release 1.0.148</li>
<li><a href="30f7c7110d"><code>30f7c71</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2331">#2331</a> from dtolnay/remote</li>
<li><a href="50354c2d0b"><code>50354c2</code></a> Improve error message on remote derive duplicate generics</li>
<li><a href="c4f67e679f"><code>c4f67e6</code></a> Add ui test of duplicate generics in remote derive</li>
<li><a href="0daafe423f"><code>0daafe4</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2330">#2330</a> from dtolnay/remote</li>
<li><a href="37021910c9"><code>3702191</code></a> Fix Into conversion involving generic remote derive with getter</li>
<li><a href="7328b34810"><code>7328b34</code></a> Add test of generic remote derive with getter</li>
<li><a href="fabbd2b097"><code>fabbd2b</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2329">#2329</a> from dtolnay/safety</li>
<li><a href="6814f978d7"><code>6814f97</code></a> Revert Buf::as_str safety change from PR 2319</li>
<li><a href="4ea403c54a"><code>4ea403c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2328">#2328</a> from dtolnay/remote</li>
<li>Additional commits viewable in <a href="https://github.com/serde-rs/serde/compare/v1.0.147...v1.0.148">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.147&new-version=1.0.148)](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 is related to the #2058 and the discussion in the discord chat.
It changes the following:
- Adds a `take` method to `JsArrayBuffer`
- Builds out `JsArrayBuffer` docs
- Adds a `JsArrayBuffer::take()` example to `jsarraybuffer.rs` in `boa_examples`
This Pull Request restructures the lint deny/warn/allow lists in `boa_engine`. It adds a lot of documentation to pup functions. There are still a few clippy lints that are not fixed, mainly regarding casting of number types. Fixing those lints effectiveley would in some cases probably require bigger refactors.
This should probably wait for #2449 to be merged, because that PR already fixes that lints regarding the `Date` built-in.
This PR is a WIP implementation of a vm instruction flowgraph generator
This aims to make the vm easier to debug and understand for both newcomers and experienced devs.
For example if we have the following code:
```js
let i = 0;
while (i < 10) {
if (i == 3) {
break;
}
i++;
}
```
It generates the following instructions (which is hard to read, especially jumps):
<details>
```
----------------------Compiled Output: '<main>'-----------------------
Location Count Opcode Operands
000000 0000 PushZero
000001 0001 DefInitLet 0000: 'i'
000006 0002 LoopStart
000007 0003 LoopContinue
000008 0004 GetName 0000: 'i'
000013 0005 PushInt8 10
000015 0006 LessThan
000016 0007 JumpIfFalse 78
000021 0008 PushDeclarativeEnvironment 0, 1
000030 0009 GetName 0000: 'i'
000035 0010 PushInt8 3
000037 0011 Eq
000038 0012 JumpIfFalse 58
000043 0013 PushDeclarativeEnvironment 0, 0
000052 0014 Jump 78
000057 0015 PopEnvironment
000058 0016 GetName 0000: 'i'
000063 0017 IncPost
000064 0018 RotateRight 2
000066 0019 SetName 0000: 'i'
000071 0020 Pop
000072 0021 PopEnvironment
000073 0022 Jump 7
000078 0023 LoopEnd
Literals:
<empty>
Bindings:
0000: i
Functions:
<empty>
```
</details>
And the flow graph is generated:
![flowgraph](https://user-images.githubusercontent.com/8566042/200589387-40b36ad7-d2f2-4918-a3e4-5a8fa5eee89b.png)
The beginning of the function is marked by the `start` node (in green) and end (in red). In branching the "yes" branch is marked in green and "no" in red.
~~This only generates in [graphviz format](https://en.wikipedia.org/wiki/DOT_(graph_description_language)) (a widely used format) but it would be nice to also generate to a format that `mermaid.js` can understand and that could be put in articles https://github.com/boa-dev/boa-dev.github.io/issues/26~~
TODO:
- [x] Generate graphviz format
- [x] Generate mermaid format
- [x] Programmatically generate colors push and pop env instructions
- [x] Display nested functions in sub-sub-graphs.
- [x] Put under a feature (`"flowgraph"`)
- [x] Handle try/catch, switch instructions
- [x] CLI option for configuring direction of flow (by default it is top down)
- [x] Handle `Throw` instruction (requires keeping track of try blocks)
- [x] Documentation
- [x] Prevent node name collisions (functions with the same name)
Just a general cleanup of the `Date` builtin to use slightly better patterns and to fix our warnings about deprecated functions.
About the regressed tests. It seems to be a `chrono` bug, so I opened up an issue (https://github.com/chronotope/chrono/issues/884) for it and they've already opened a PR fixing it (https://github.com/chronotope/chrono/pull/885).
However, while checking out the remaining failing tests, I realized there's a more fundamental limitation with the library. Currently, [`chrono`](https://github.com/chronotope/chrono) specifies:
> Date types are limited in about +/- 262,000 years from the common epoch.
While the [ECMAScript spec](https://tc39.es/ecma262/#sec-time-values-and-time-range) says:
> The smaller range supported by a time value as specified in this section is approximately -273,790 to 273,790 years relative to 1970.
The range allowed by the spec is barely outside of the range supported by `chrono`! This is why the remaining `Date` tests fail.
Seeing that, I would like to ping @djc and @esheppa (the maintainers of `chrono`) to ask if it would be feasible to add a feature, akin to the `large-dates` feature from the `time` crate, that expands the supported range of `chrono`.
EDIT: Filed https://github.com/chronotope/chrono/issues/886
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.88 to 1.0.89.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/json/releases">serde_json's releases</a>.</em></p>
<blockquote>
<h2>v1.0.89</h2>
<ul>
<li>Fix invalid JSON incorrectly accepted when a large number has no digits after decimal point (<a href="https://github-redirect.dependabot.com/serde-rs/json/issues/953">#953</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="d2f936855d"><code>d2f9368</code></a> Release 1.0.89</li>
<li><a href="0b898369f9"><code>0b89836</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/json/issues/956">#956</a> from dtolnay/decimal</li>
<li><a href="9d94e920ef"><code>9d94e92</code></a> Require at least one digit after decimal point</li>
<li><a href="c27b02334b"><code>c27b023</code></a> Add regression test for issue 953</li>
<li><a href="586fefb5a1"><code>586fefb</code></a> Resolve semicolon_if_nothing_returned pedantic clippy lint</li>
<li>See full diff in <a href="https://github.com/serde-rs/json/compare/v1.0.88...v1.0.89">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde_json&package-manager=cargo&previous-version=1.0.88&new-version=1.0.89)](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 [indexmap](https://github.com/bluss/indexmap) from 1.9.1 to 1.9.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/bluss/indexmap/blob/master/RELEASES.md">indexmap's changelog</a>.</em></p>
<blockquote>
<ul>
<li>
<p>1.9.2</p>
<ul>
<li><code>IndexMap</code> and <code>IndexSet</code> both implement <code>arbitrary::Arbitrary<'_></code> and
<code>quickcheck::Arbitrary</code> if those optional dependency features are enabled.</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="4d52cf338c"><code>4d52cf3</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/bluss/indexmap/issues/247">#247</a> from cuviper/arbitrary-1.x</li>
<li><a href="4d410509d2"><code>4d41050</code></a> Release 1.9.2</li>
<li><a href="bc1a12f7f3"><code>bc1a12f</code></a> Add an Arbitrary release note</li>
<li><a href="2251812717"><code>2251812</code></a> impl Arbitrary for IndexMap and IndexSet</li>
<li><a href="fe98ec2a03"><code>fe98ec2</code></a> Revert "Run CI on 1.56.1 until next hashbrown release"</li>
<li>See full diff in <a href="https://github.com/bluss/indexmap/compare/1.9.1...1.9.2">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=indexmap&package-manager=cargo&previous-version=1.9.1&new-version=1.9.2)](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 [serde_json](https://github.com/serde-rs/json) from 1.0.87 to 1.0.88.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/serde-rs/json/releases">serde_json's releases</a>.</em></p>
<blockquote>
<h2>v1.0.88</h2>
<ul>
<li>Optimize serde_json::Map's implementation of <code>append</code> and <code>clone_from</code> (<a href="https://github-redirect.dependabot.com/serde-rs/json/issues/952">#952</a>, thanks <a href="https://github.com/Lucretiel"><code>@Lucretiel</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="9eb66da7e0"><code>9eb66da</code></a> Release 1.0.88</li>
<li><a href="057957ccf4"><code>057957c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/serde-rs/json/issues/952">#952</a> from Lucretiel/map-traits</li>
<li><a href="3347248d82"><code>3347248</code></a> Add <code>clone_from</code> to <code>Map</code>; <code>Map::append</code> now uses <code>IndexMap::extend</code></li>
<li><a href="ca41bdd563"><code>ca41bdd</code></a> Update ui test suite to nightly-2022-11-16</li>
<li><a href="4f194c9141"><code>4f194c9</code></a> Resolve needless_borrow pedantic clippy lint in test</li>
<li>See full diff in <a href="https://github.com/serde-rs/json/compare/v1.0.87...v1.0.88">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde_json&package-manager=cargo&previous-version=1.0.87&new-version=1.0.88)](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 offers a basic VM fuzzer which relies on implied oracles (namely, "does it crash or timeout?").
It changes the following:
- Adds an insns_remaining field to Context, denoting the number of instructions remaining to execute (only available when fuzzing)
- Adds a JsNativeError variant, denoting when the number of instructions has been exceeded (only available when fuzzing)
- Adds a VM fuzzer which looks for cases where Boa may crash on an input
This offers no guarantees about correctness, only assertion violations. Depends on #2400.
Any issues I raise in association with this fuzzer will link back to this fuzzer.
You may run the fuzzer using the following commands:
```bash
$ cd boa_engine
$ cargo +nightly fuzz run -s none vm-implied
```
Co-authored-by: Addison Crump <addison.crump@cispa.de>
<!---
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 [chrono](https://github.com/chronotope/chrono) from 0.4.22 to 0.4.23.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/chronotope/chrono/releases">chrono's releases</a>.</em></p>
<blockquote>
<p>0.4.23 is the next 0.4 release of the popular chrono date and time library for Rust. After the 0.4.20-0.4.22 series that brought chrono back to life after a long hiatus, development has been fairly quiet, allowing us to start planning changes for the 0.5.0 release. As such, we've started deprecating some APIs that are likely to be removed in 0.5. If you have any feedback on these changes, please let us know in the issue tracker!</p>
<h3>Deprecations</h3>
<ul>
<li>Deprecate methods that have an <code>_opt()</code> alternative (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/827">#827</a>)</li>
<li>Deprecate usage of the <code>Date<Tz></code> type (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/851">#851</a>)</li>
</ul>
<h3>Features</h3>
<ul>
<li>Optimize RFC 3339 (and RFC 2822) encoding (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/844">#844</a>, thanks to <a href="https://github.com/conradludgate"><code>@conradludgate</code></a>)</li>
<li>Addition and subtraction with the <code>Days</code> type (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/784">#784</a>)</li>
<li>Add <code>NaiveDateTime::from_timestamp_millis(_opt)</code> (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/818">#818</a>, thanks to <a href="https://github.com/Pscheidl"><code>@Pscheidl</code></a> -- backported in <a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/823">#823</a>)</li>
<li>Allow for changing TZ variable and cache it for <code>Local</code> timezone (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/853">#853</a>)</li>
<li>Add optional support for the <code>arbitrary::Arbitrary</code> trait (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/849">#849</a>, thanks to <a href="https://github.com/greyblake"><code>@greyblake</code></a> and <a href="https://github.com/asayers"><code>@asayers</code></a>)</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>Support tzdb location on AIX (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/826">#826</a>)</li>
<li>Fix warnings in documentation (<a href="https://github-redirect.dependabot.com/chronotope/chrono/issues/847">#847</a>)</li>
</ul>
<p>On behalf of <a href="https://github.com/esheppa"><code>@esheppa</code></a> and <a href="https://github.com/djc"><code>@djc</code></a>, thanks to all contributors!</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="9e5eb49838"><code>9e5eb49</code></a> Bump version to 0.4.23</li>
<li><a href="dc4287a627"><code>dc4287a</code></a> store hash of environment variable</li>
<li><a href="57908e918b"><code>57908e9</code></a> allow sharing of the allocated environment variable</li>
<li><a href="84f3c30d1e"><code>84f3c30</code></a> move last_changed to the Cache</li>
<li><a href="8bc413936f"><code>8bc4139</code></a> add bench for Local::now()</li>
<li><a href="22b4d32498"><code>22b4d32</code></a> Avoid use of deprecated API</li>
<li><a href="77317d5255"><code>77317d5</code></a> Deprecate usage of the Date<Tz> type</li>
<li><a href="7ba090d484"><code>7ba090d</code></a> Add TimeZone::with_ymd_and_hms() helper method</li>
<li><a href="03165c8658"><code>03165c8</code></a> Move Date::years_since() implementation into NaiveDate</li>
<li><a href="645fca0c55"><code>645fca0</code></a> chore: apply clippy suggestions for 1.65</li>
<li>Additional commits viewable in <a href="https://github.com/chronotope/chrono/compare/v0.4.22...v0.4.23">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=chrono&package-manager=cargo&previous-version=0.4.22&new-version=0.4.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>
This PR adds a safe wrapper around JavaScript `JsDate` from `builtins::date`, and is being tracked at #2098.
#### Implements following methods
- [x] `new Date()`
- [x] `Date.prototype.getDate()`
- [x] `Date.prototype.getDay()`
- [x] `Date.prototype.getFullYear()`
- [x] `Date.prototype.getHours()`
- [x] `Date.prototype.getMilliseconds()`
- [x] `Date.prototype.getMinutes()`
- [x] `Date.prototype.getMonth()`
- [x] `Date.prototype.getSeconds()`
- [x] `Date.prototype.getTime()`
- [x] `Date.prototype.getTimezoneOffset()`
- [x] `Date.prototype.getUTCDate()`
- [x] `Date.prototype.getUTCDay()`
- [x] `Date.prototype.getUTCFullYear()`
- [x] `Date.prototype.getUTCHours()`
- [x] `Date.prototype.getUTCMilliseconds()`
- [x] `Date.prototype.getUTCMinutes()`
- [x] `Date.prototype.getUTCMonth()`
- [x] `Date.prototype.getUTCSeconds()`
- [x] `Date.prototype.getYear()`
- [x] `Date.now()`
- [ ] `Date.parse()` Issue 4
- [x] `Date.prototype.setDate()`
- [x] `Date.prototype.setFullYear()`
- [ ] `Date.prototype.setHours()` Issue 3
- [x] `Date.prototype.setMilliseconds()`
- [ ] `Date.prototype.setMinutes()` Issue 3
- [x] `Date.prototype.setMonth()`
- [x] `Date.prototype.setSeconds()`
- [x] `Date.prototype.setTime()`
- [x] `Date.prototype.setUTCDate()`
- [x] `Date.prototype.setUTCFullYear()`
- [x] `Date.prototype.setUTCHours()`
- [x] `Date.prototype.setUTCMilliseconds()`
- [x] `Date.prototype.setUTCMinutes()`
- [x] `Date.prototype.setUTCMonth()`
- [x] `Date.prototype.setUTCSeconds()`
- [x] `Date.prototype.setYear()`
- [ ] `Date.prototype.toDateString()` Issue 5
- [ ] `Date.prototype.toGMTString()` Issue 5
- [ ] `Date.prototype.toISOString()` Issue 5
- [ ] `Date.prototype.toJSON()` Issue 5
- [ ] `Date.prototype.toLocaleDateString()` Issue 5 and 6
- [ ] `Date.prototype.toLocaleString()` Issue 5 and 6
- [ ] `Date.prototype.toLocaleTimeString()` Issue 5 and 6
- [ ] `Date.prototype.toString()` Issue 5
- [ ] `Date.prototype.toTimeString()` Issue 5
- [ ] `Date.prototype.toUTCString()` Issue 5
- [x] `Date.UTC()`
- [x] `Date.prototype.valueOf()`
### Issues
1. ~~`get_*()` and some other methods - They take `&self` as input internally, and internal struct shouldn't be used in a wrapper API. Therefore, these would require input to be `this: &JsValue, args: &[JsValue], context: &mut Context` like others and use `this_time_value()`?~~ Fixed using `this_time_value()`
2. ~~`to_string()`- how can I use `Date::to_string()` rather than `alloc::string::ToString`.~~ My bad it compiles, just `rust-analyzer` was showing it as an issue.
3. `set_hours()` and `set_minutes()` - they subtract local timezones when setting the value, e.g.
- On further look:
```rust
// both function call `builtins:📅:mod.rs#L1038
this.set_data(ObjectData::date(t));
// `ObjectData::date` creates a new `Date` object `object::mods.rs#L423
// | this date is chrono::Date<Tz(TimezoneOffset)> and Tz default is being used here which is GMT+0
pub fn date(date: Date) -> Self {
Self {
kind: ObjectKind::Date(date),
internal_methods: &ORDINARY_INTERNAL_METHODS,
}
}
```
- BTW, in `object::mod.rs`'s `enum ObjectKind` there is `Date(chrono::Date)` and it requires
the generic argument, how is it being bypassed here?
- Also in `set_minutes()` step 6, `LocalTime` should be used.
```rust
// reference date = 2000-01-01T06:26:53.984
date.set_hours(&[23.into(), 23.into(), 23.into(), 23.into()], context)?;
// would add tiemzone(+5:30) to it
// Is 2000-01-01T17:53:23.023
// Should be 2000-01-01T23:23:23.023
```
4. `parse()` - it uses `chrono::parse_from_rfc3339` internally, while es6 spec recommends ISO8601. And it can also parse other formats like from [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse) `04 Dec 1995 00:12:00 GMT` which fails. So what should be done about it.
5. `to_*()` - This is more general, as the internal date object uses `chrono::NaiveDateTime` which doesn't have timezone. It doesn't account for `+4:00` in example below.
```rust
// Creates new `Date` object from given rfc3339 string.
let date = JsDate::new_from_parse(&JsValue::new("2018-01-26T18:30:09.453+04:00"), context);
println!("to_string: {:?}", date2.to_string(context)?);
// IS: Sat Jan 27 2018 00:00:09 GMT+0530
// Should: Fri Jan 26 2018 20:00:09 GMT+0530
```
6. `to_locale_*()` - requires [`ToDateTimeOptions`](https://402.ecma-international.org/9.0/#sec-todatetimeoptions) and localization would require chrono's `unstable-locales` feature, which is available for `DateTime` and not for `NaiveDateTime`.
- I should have looked properly, `to_date_time_options` is already implemented in `builtins::intl`. Anyway, I would still need some tips on how to use it. What would function signature be like in wrapper API, how would `options` be passed to the said API.
- So `to_date_time_options()` takes `options: &JsValue` as an argument and build an object from it and fetch properties through `Object.get()`. If I want `options` to be `{ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }` what would `JsValue` look like to make it all work.
```rust
date.to_locale_date_string(&[JsValue::new("en_EN"), OPTIONS], context)?;
// OPTIONS need to be a JsValue which when converted into an object
// have these properties { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
```
### Possible improvements
1. Right now, `object::jsdate::set_full_year()` and alike (input is a slice) are like below, `into()` doesn't feel ergonomic.
```rust
#[inline]
pub fn set_full_year(&self, values: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
Date::set_full_year(&self.inner.clone().into(), values, context)
}
// Usage
date.set_full_year(&[2000.into(), 0.into(), 1.into()], context)?;
// How can something like this be made to work
#[inline]
pub fn set_full_year<T>(&self, values: &[T], context: &mut Context) -> JsResult<JsValue>
where
T: Into<JsValue>,
{
| expected reference `&[value::JsValue]`
| found reference `&[T]`
Date::set_full_year(&self.inner.clone().into(), values, context)
}
```
2. Any other suggestion?
Bumps [sys-locale](https://github.com/1Password/sys-locale) from 0.2.1 to 0.2.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/1Password/sys-locale/releases">sys-locale's releases</a>.</em></p>
<blockquote>
<h2>v0.2.3</h2>
<p>See <a href="https://github.com/1Password/sys-locale/blob/main/CHANGELOG.md#023---2022-11-06">the changelog</a> for details.</p>
<h2>v0.2.2</h2>
<p>See <a href="https://github.com/1Password/sys-locale/blob/main/CHANGELOG.md#022---2022-11-06">the changelog</a> for details.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/1Password/sys-locale/blob/main/CHANGELOG.md">sys-locale's changelog</a>.</em></p>
<blockquote>
<h2>[0.2.3] - 2022-11-06</h2>
<h3>Fixed</h3>
<ul>
<li>Re-release 0.2.2 and correctly maintain <code>no_std</code> compatibility on Apple targets.</li>
</ul>
<h2>[0.2.2] - 2022-11-06</h2>
<h3>Changed</h3>
<ul>
<li>The Apple backend has been rewritten in pure Rust instead of Objective-C.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>The locale returned on UNIX systems is now always a correctly formatted BCP-47 tag.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="21a5596bb6"><code>21a5596</code></a> Release 0.2.3</li>
<li><a href="6717e5662a"><code>6717e56</code></a> Use manual CoreFoundation bindings instead of core-foundation-sys</li>
<li><a href="f4dee466cf"><code>f4dee46</code></a> Release 0.2.2</li>
<li><a href="db4471ebff"><code>db4471e</code></a> Convert CHANGELOG.md to LF line endings</li>
<li><a href="a35c485c10"><code>a35c485</code></a> Update CHANGELOG</li>
<li><a href="ad29e24f7b"><code>ad29e24</code></a> Rewrite Apple locale fetching in pure Rust</li>
<li><a href="e76d9c55d1"><code>e76d9c5</code></a> Improve locale fetching tests</li>
<li><a href="29f4f2582b"><code>29f4f25</code></a> Fix implementation for Linux</li>
<li><a href="7c58f80849"><code>7c58f80</code></a> Fix cross-compiling CI</li>
<li>See full diff in <a href="https://github.com/1Password/sys-locale/compare/v0.2.1...v0.2.3">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=sys-locale&package-manager=cargo&previous-version=0.2.1&new-version=0.2.3)](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 offers a fuzzer which is capable of detecting faults in the parser and interner. It does so by ensuring that the parsed AST remains the same between a parsed source and the result of parsing the `to_interned_string` result of the first parsed source.
It changes the following:
- Adds a fuzzer for the parser and interner.
Any issues I raise in association with this fuzzer will link back to this fuzzer.
You may run the fuzzer using the following commands:
```bash
$ cd boa_engine
$ cargo +nightly fuzz run -s none parser-idempotency
```
Co-authored-by: Addison Crump <addison.crump@cispa.de>
This PR adds an `OrAbrupt` trait, with the `or_abrupt()` function. This function is equivalent to the previous `?.ok_or(ParseError::AbruptEnd)`, but it's cleaner. It's implemented for the parser cursor results types.
It also adds an `advance()` function to the parser cursor (which might be possible to optimize further), that just advances the cursor without returning any token. This shows a clearer intent in many places where it's being used.
I also used `ParseResult` in more places, since we were not using it in many places.
This PR rewrites some patterns of the `JsString` implementation in order to pass all its miri tests. This can be verified by running:
```bash
cargo +nightly miri test -p boa_engine string::tests -- --skip builtins --skip parser
```
Basically, we were doing two operations that were Undefined Behaviour per the [Stacked Borrows](https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md) model:
- Casting `&JsString` to `&mut RawJsString` to `&[u16]`. The intermediate mutable borrow must not exist, or Miri considers this as Undefined Behaviour.
- Trying to access `RawJsString.data` using the dot operator. Miri complains with `this is a zero-size retag ([0x10..0x10]) so the tag in question does not exist anywhere`. To fix this, we can recompute the position of `data` every time we want to access it.
This PR rewrites all syntax-directed operations that find declared names and variables using visitors.
Hopefully, this should be the last step before finally being able to separate the parser from the engine.
I checked the failing [tests](85373b4ce1/test/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-target-yield-expr.js (L49)) and they're apparently false positives, since they return `Promise { <rejected> ReferenceError: x is not initialized }` on the main branch.
Right now our promises print `{ }` on display. This PR improves a bit the display and ergonomics of promises in general. Now, promises will print...
- When pending: `Promise { <pending> }`
- When fulfilled: `Promise { "hi" }`
- When rejected: `Promise { <rejected> ReferenceError: x is not initialized }`
This Pull Request updates the codebase to the newest version of rustc (1.65.0).
It changes the following:
- Bumps `rust-version` to 1.65.0.
- Rewrites some snippets to use the new let else, ok_or_else and some other utils.
- Removes the `rustdoc::missing_doc_code_examples` allow lint from our codebase. (Context: https://github.com/rust-lang/rust/pull/101732)
This Pull Request fixes#1805.
It changes the following:
- Implement async arrow function parsing and execution.
- Handle special case when a function expressions binding identifier need to be bound in the function body.
- Implement special silent ignored assignment for the above case.
- Fix issue with getting the correct promise capability for function returns.
- Complete function object `toString` todo.
I will fix the two failing assignmenttargettype tests in a follow up PR.
This Pull Request replaces `contains`, `contains_arguments`, `has_direct_super` and `function_contains_super` with visitors. (~1000 removed lines!)
Also, the new visitor implementation caught a bug where we weren't setting the home object of async functions, generators and async generators for methods of classes, which caused a stack overflow on `super` calls, and I think that's pretty cool!
Next is `var_declared_names`, `lexically_declared_names` and friends, which will be on another PR.
This should hopefully improve our compilation times, both from a clean build and from an incremental compilation snapshot.
Next would be the parser, but it imports `Context`, so it'll require a bit more work.
The number of file changes is obviously big, but almost nothing was changed, I just moved everything to another crate and readjusted the imports of the `parser` module. (Though, I did have to change some details, because there were some functions on the ast that returned `ParseError`s, and the tests had to be moved to the parser)
This Pull Request closes no specific issue, but allows for analysis and post-processing passes by both internal and external developers.
It changes the following:
- Adds a Visitor trait, to be implemented by visitors of a particular node type.
- Adds `Type`Visitor traits which offer access to private members of a node.
- Adds an example which demonstrates the use of Visitor traits by walking over an AST and printing its contents.
At this time, the PR is more of a demonstration of intent rather than a full PR. Once it's in a satisfactory state, I'll mark it as not a draft.
Co-authored-by: Addison Crump <addison.crump@cispa.de>
This Pull Request implements `delete` for variable references:
```Javascript
x = 5;
console.log(x) // 5;
delete x;
console.log(x) // ReferenceError
```
It changes the following:
- Implements delete for references.
- Fixes tests related to deletions of function definitions inside `eval`.
- Implements an op to throw an error on super property deletion.
This puts us at a conformance of 97.98% for the `test/language/expressions/delete` suite. The last 2 failing tests are related to `with` statements ([11.4.1-4.a-5.js](b5d3192914/test/language/expressions/delete/11.4.1-4.a-5.js (L1)) and [11.4.1-4.a-6.js](b5d3192914/test/language/expressions/delete/11.4.1-4.a-6.js (L18))).
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.15.0 to 1.16.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/matklad/once_cell/blob/master/CHANGELOG.md">once_cell's changelog</a>.</em></p>
<blockquote>
<h2>1.16.0</h2>
<ul>
<li>Add <code>no_std</code> implementation based on <code>critical-section</code>,
<a href="https://github-redirect.dependabot.com/matklad/once_cell/pull/195">#195</a>.</li>
<li>Deprecate <code>atomic-polyfill</code> feature (use the new <code>critical-section</code> instead)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="18e47d7308"><code>18e47d7</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/206">#206</a></li>
<li><a href="06ff1bd31f"><code>06ff1bd</code></a> publish 1.16.0</li>
<li><a href="04e1d59ce7"><code>04e1d59</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/204">#204</a></li>
<li><a href="32ba3f8aa8"><code>32ba3f8</code></a> clarify MSRV</li>
<li><a href="0ebafa5d2f"><code>0ebafa5</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/203">#203</a></li>
<li><a href="cb85e6b8b8"><code>cb85e6b</code></a> publish 1.16.0-pre.1</li>
<li><a href="b56e329d70"><code>b56e329</code></a> Merge <a href="https://github-redirect.dependabot.com/matklad/once_cell/issues/195">#195</a></li>
<li><a href="7d9afdb9d7"><code>7d9afdb</code></a> Add comment explaining <code>Mutex\<unsync::OnceCell></code>.</li>
<li><a href="32dada4dbe"><code>32dada4</code></a> Fix features.</li>
<li><a href="23d129038f"><code>23d1290</code></a> Decrease <code>critical-section</code> version.</li>
<li>Additional commits viewable in <a href="https://github.com/matklad/once_cell/compare/v1.15.0...v1.16.0">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=once_cell&package-manager=cargo&previous-version=1.15.0&new-version=1.16.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>
Fixes#1917 (fixes the code example given with the hashes)
Fixes the order dependent execution of assignment, so the following code works correctly:
```javascript
function f(x) { console.log(x) } // used to check the order of execution
let a = [[]]
(f(1), a)[(f(2), 0)][(f(3), 0)] = (f(4), 123) // 🤮
```
Prints out:
```bash
1
2
3
4
123
```
As expected
This introduces some opcodes:
- ~~`Swap3`: currently used only to keep some previous code working that needs refactoring.~~
- ~~`RotateRight n`: Rotates the `n` top values from the top of the stack to the right by `1`.~~ Already added by #2390
~~Besides the new opcodes,~~ Some opcodes pop and push order of values on the stack have been changed. To eliminate many swaps and to make this change easier.
~~This PR is still a WIP and needs more refactoring~~
This is now ready for review/merge :)
This Pull Request implements optional chains.
Example:
```Javascript
const adventurer = {
name: 'Alice',
cat: {
name: 'Dinah'
}
};
console.log(adventurer.cat?.name); // Dinah
console.log(adventurer.dog?.name); // undefined
```
Since I needed to implement `Opcode::RotateLeft`, and #2378 had an implementation for `Opcode::RotateRight`, I took the opportunity to integrate both ops into this PR (big thanks to @HalidOdat for the original implementation!).
This PR almost has 100% conformance for the `optional-chaining` test suite. However, there's this one [test](85373b4ce1/test/language/expressions/optional-chaining/member-expression.js) that can't be solved until we properly set function names for function expressions in object and class definitions.
<!---
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 is related to #2098.
It changes the following:
- Implements a wrapper for the `Generator` built-in object
- Adds to some of the documentation across the builtin wrappers with the goal of trying to clean up the documentation by making it a bit more consistent [on boa's docs](https://boa-dev.github.io/boa/doc/boa_engine/object/builtins/index.html)
This Pull Request allows collisions of var declarations with already existing lexical bindings if the `eval` call is strict or occurs within strict code. In short, it allows:
```Javascript
{
let x;
{
eval('"use strict"; var x;');
}
}
```
and
```Javascript
"use strict";
{
let x;
{
eval('var x;');
}
}
```
This is valid since in strict code all `eval` calls get their own function environment, making it impossible to declare a new var in the outer function environment. This change also skips poisoning environments on strict code, because `eval` cannot add new declarations for the current environment in that situation.
This Pull Request implements member accessors in `for ... in` and `for ... of` loops. This unlocks patterns like:
```Javascript
let obj = {a: 0, b: 1};
for (obj.a of [1,2,3]) {
}
console.log(obj.a) // 3
```