<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->
This Pull Request implements ResolveLocale abstract method. It is required for further InitializeDateTimeFormat development.
It changes the following:
- Adds several helpers to operate with locale extensions
- Adds DefaultLocale placeholder
- Implements BestAvailableLocale and locale matchers
- Implements UnicodeExtensionsComponents
- Introduces testing
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.136 to 1.0.137.
<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.137</h2>
<ul>
<li>Update documentation links to some data formats whose repos have moved (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2201">#2201</a>, thanks <a href="https://github.com/atouchet"><code>@atouchet</code></a>)</li>
<li>Fix declared <code>rust-version</code> of serde and serde_test (<a href="https://github-redirect.dependabot.com/serde-rs/serde/issues/2168">#2168</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="17c3c0cf86"><code>17c3c0c</code></a> Release 1.0.137</li>
<li><a href="210e6c354e"><code>210e6c3</code></a> Clean up clippy allows which are superseded by msrv in clippy.toml</li>
<li><a href="41823a96df"><code>41823a9</code></a> Ignore more type_repetition_in_bounds</li>
<li><a href="7ca13ff240"><code>7ca13ff</code></a> Ignore type_repetition_in_bounds lint that is incompatible with msrv</li>
<li><a href="52391fd868"><code>52391fd</code></a> Inform clippy of supported compiler version in clippy.toml</li>
<li><a href="9b2d8dfc6b"><code>9b2d8df</code></a> Add a miri test job in CI</li>
<li><a href="07ba7ea8dd"><code>07ba7ea</code></a> Update workflows to actions/checkout@v3</li>
<li><a href="9f29f6bb4a"><code>9f29f6b</code></a> Disable expandtest on miri</li>
<li><a href="f6c104fd1d"><code>f6c104f</code></a> Ignore unused ignore attribute warning in some configurations</li>
<li><a href="8a3a6fb101"><code>8a3a6fb</code></a> Disable ui test on miri</li>
<li>Additional commits viewable in <a href="https://github.com/serde-rs/serde/compare/v1.0.136...v1.0.137">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.136&new-version=1.0.137)](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.79 to 1.0.80.
<details>
<summary>Commits</summary>
<ul>
<li><a href="585e4c5dc7"><code>585e4c5</code></a> Release 1.0.80</li>
<li><a href="52a9c050f5"><code>52a9c05</code></a> Pull miri from miri branch of dtolnay/rust-toolchain</li>
<li><a href="aff685b8c9"><code>aff685b</code></a> Drop unneeded quoting from env variable in workflows yaml</li>
<li><a href="6995bbf784"><code>6995bbf</code></a> Update workflows to actions/checkout@v3</li>
<li><a href="829175e606"><code>829175e</code></a> Fix dev dependencies on serde's derive feature</li>
<li><a href="2733e635b3"><code>2733e63</code></a> Rewrap readme to 80 columns</li>
<li><a href="c5475a32db"><code>c5475a3</code></a> Apply readme changes from PR 864 to crate-level rustdoc</li>
<li><a href="56cf16f900"><code>56cf16f</code></a> Merge pull request 864 from novedevo/patch-1</li>
<li><a href="16b68b06d6"><code>16b68b0</code></a> Tweak grammar to improve readability</li>
<li>See full diff in <a href="https://github.com/serde-rs/json/compare/v1.0.79...v1.0.80">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.79&new-version=1.0.80)](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>
It changes the following:
- The current `JsString` implementation has a lot of duplicate heap allocations. For static strings, `JsString` only needs to store the index of `CONSTANTS_ARRAY`. ~~I let `JsString` can store pointer to heap or static area. The two are distinguished by the first bit. (This implementation is rough, maybe we should put flag into `Inner`, like [arcstr](70ba2fac19/src/arc_str.rs (L751-L757)))~~
- I also added more string constants, which are always used.
This PR adds `JsFunction` wrapper around JavaScript `Function` object, like #1746
With this PR we can distinguish between regular object and function object when we need, such as accessors (because they always need to be functions), predicates in `JsArray` methods like `map`, `find`, etc. With this abstraction we leverage the type system of rust which cleans the API making intentions clear.
It changes the following:
- Make methods that take predicate/callback function take `JsFunction`s
- Make `.accessor()` and `.static_accessor()` take `Option<JsFunction>`
- Make `FunctionBuilder` return `JsFunction`
- Make `ConstructorBuilder` return `JsFunction`
- Make `ClassBuilder` return `JsFunction`
This Pull Request changes the following:
- Implement redeclaration errors in the parser
- Remove redeclaration errors from the compiler (this is a big step towards #1907)
- Fix some failing tests on the way
This requires a slight change in our public api. The Parser new requires a full `Context` instead of just the `Interner` for parsing new code. This is required, because if multiple scripts are parsed (e.g. every input in the REPL) global variables must be checked for redeclarations.
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->
This Pull Request provides initial implementation for DateTimeFormat constructor. It relates to #1562.
It changes the following:
- Adds `Intl.DateTimeFormat` property
- Partially implements `DateTimeFormat` constructor (`InitializeDateTimeFormat` step is postponed).
- Introduces `ObjectData::DateTimeFormat`
It changes the following:
- `Symbol` object has `[[Construct]]` internal method
- Fix and comment step 1 in `Symbol` constructor.
- Implement step 1 in `BigInt` constructor.
This Pull Request fixes a faulty cast for `Array.splice`.
Negative values for delete_count were being directly casted to usize, which was not the intended behavior. This pull request fixes the issue by using a fallible conversion, defaulting to 0 if the conversion fails.
It changes the following:
- Replace cast in `Array.splice` prototype method with fallible conversion.
This Pull Request changes the following:
- Remove syntax error for unicode escaped characters in keywords from the lexer.
- Adjust the lexer tokens for keywords to indicate if they contain unicode escaped characters.
- Throw syntax errors in parser, when keywords cannot contain unicode escaped characters.
This Pull Request changes the following:
- Allow `Initializer` after `ArrayBindingPattern` in `FormalParameter`
- Refactor `Initializer` detection in `FormalParameter` to avoid clones
This Pull Request changes the following:
- Allow `PropertyName`s in `BindingProperty`in `ObjectBindingPattern`. Previously only `BindingIdentifier`s where allowed.
This Pull Request supersedes #2018 and #2017.
It changes the following:
- Updates the wasm-bindgen dependency now that a new version without the clippy bug has been released
- Updates all dependencies to their latest versions
`ArrayBuffer.isView()` should check whether the object contains a `[[ViewedArrayBuffer]]` internal slot, which `DataView` has.
It changes the following:
- Fix `ArrayBuffer.isView()`
This Pull Request fixes/closes #337.
It changes the following:
- Implement class declaration parsing.
- Implement class expression parsing.
- Implement class execution.
There are still some features like `super` missing and there are some early errors that are not implemented yet. But I think it makes sense to merge this, as we can branch out the missing features from here.
This Pull Request fixes `byteLength` for `ArrayBuffer`. It should be an accessor property rather than a method, per the spec.
It changes the following:
- Removes `byteLength` method for `ArrayBuffer` built-in.
- Add `byteLength` accessor property for `ArrayBuffer`.
- Change `byte_length` function name to `get_byte_length`, to match other function names used for accessor properties.
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->
This Pull Request fixes/closes #1989.
It changes the following:
- Implements From<f32> for JsValue
Acked-by: Taylor Sutton <tsutton125@gmail.com>
This Pull Request fixes/closes #1998
The call to retrieve operands modifies pc, setting it to the index of
the *next* instruction. So, we save its initial value and use that
for printing.
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.8.0 to 1.8.1.
<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.8.1</p>
<ul>
<li>The new <code>IndexSet::replace_full</code> will return the index of the item along
with the replaced value, if any, by <a href="https://github.com/zakcutner"><code>@zakcutner</code></a> in PR <a href="https://github-redirect.dependabot.com/bluss/indexmap/pull/222">222</a>.</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="275379c489"><code>275379c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/bluss/indexmap/issues/222">#222</a> from zakcutner/replace-full</li>
<li><a href="12162abeb0"><code>12162ab</code></a> Release 1.8.1</li>
<li><a href="feb816c4b8"><code>feb816c</code></a> Add a <code>replace_full</code> method on <code>IndexSet</code></li>
<li><a href="d6a9dd6c91"><code>d6a9dd6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/bluss/indexmap/issues/218">#218</a> from erickt/miri</li>
<li><a href="4dd6619b4c"><code>4dd6619</code></a> Add miri builder</li>
<li><a href="10ee11e56c"><code>10ee11e</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/bluss/indexmap/issues/216">#216</a> from cuviper/dev-dependencies</li>
<li><a href="98de9abe37"><code>98de9ab</code></a> Update dev-dependencies</li>
<li>See full diff in <a href="https://github.com/bluss/indexmap/compare/1.8.0...1.8.1">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.8.0&new-version=1.8.1)](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 lets true/false/null be used as object property identifiers, when using dot assignment.
`foo.null = 'bar';`
It changes the following:
- AST parsing of member expressions
This Pull Request fixes length properties on multiple array prototype methods that were including rest parameters in the count. More tests should pass.
It changes the following:
- Length properties on some array prototype methods
This Pull Request makes the non-octal-decimal-integer test pass. The test would previously fail for values with multiple leading zeroes.
It changes the following:
- Number lexer
`Node::DoWhileLoop` ast node had a buggy bytecode generation where `self.patch_jump(exit)` was called after emitting `LoopEnd` opcode. This would patch the loop exit to the instruction following the do while code, which would panic in cases where do while was enclosed in a block statement.
This Pull Request fixes#1929.
It changes the following:
- Patch jump before emitting `Opcode::LoopEnd`
- Add test which has do while statement inside a block statement to demonstrate that the change fixes the panic.
This Pull Request fixes/closes #1962.
It changes the following:
- When executing arithmetic operations on `JsValue`s, try to use integer operations and fallback to `f64` operations on error.
- Adds tests for serde_json conversions from integer operations.
Some of the fields in AST structs were both
1. Arrays
2. Marked as 'flatten'
This is illegal per serde docs (and doesn't really make sense).
The fix is to remove the attribute.
See: https://serde.rs/attr-flatten.htmlFixes: #1920
Co-authored-by: Taras Boiko <me@tboiko.com>
This Pull Request fixes/closes #1942.
`Date.prototype.toDateString` should return a value representing the local date. The Rust `Date` inner value represents UTC time, so it should be adjusted to local time before formatting (see equivalent conversions performed by `to_string` and `to_time_string`).
To verify this is working as intended, run the test suite with your OS timezone set to `GMT+0`, then again with `GMT+10`. The test `date_proto_to_date_string` should pass for each. For me (Ubuntu via WSL), this can be done with `sudo dpkg-reconfigure tzdata`.
This PR also fixes a couple other test cases that used the wrong month value (as noted at the top of the file, JS months are 0-based while `chrono` months are 1-based).
This Pull Request closes#1948.
It changes the following:
- set `readme` in `boa_engine` so `README.md` will be published to crates.io
- remove unnecessary `exclude` field from `Cargo.toml` in all apps
I was unsure whether using a path outside of the workspace root was allowed for `readme` since it [doesn't get included in the release tarball](https://github.com/rust-lang/cargo/issues/5911), but this exact path is used by [juniper](https://github.com/graphql-rust/juniper/blob/master/juniper/Cargo.toml#L13) and [seems to work there](https://crates.io/crates/juniper). I believe `cargo publish` does a bit more than just uploading the tarball, including pulling the `readme` from any arbitrary path.
The default behaviour of `cargo package`/`cargo publish` if neither `exclude` or `include` is specified is to include all files from the package root, excluding
- dotfiles
- .gitignore'd files
- subpackages (any subdirectory with a `Cargo.toml` file)
- the `/target` directory
There's no need to explicitly exclude files from the parent directory since they're already excluded by default. This can be verified by running `cargo package --list` inside any workspace app:
```plain
$ cd boa_wasm
$ cargo package --list
.gitignore
Cargo.toml
Cargo.toml.orig
src/lib.rs
```
You can read more [here](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields).
Bumps [dyn-clone](https://github.com/dtolnay/dyn-clone) from 1.0.4 to 1.0.5.
<details>
<summary>Commits</summary>
<ul>
<li><a href="1500eb86a6"><code>1500eb8</code></a> Release 1.0.5</li>
<li><a href="91b11c3e66"><code>91b11c3</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/dyn-clone/issues/14">#14</a> from dtolnay/compiletest</li>
<li><a href="6872508710"><code>6872508</code></a> Add ui test for missing DynClone supertrait</li>
<li><a href="358e75127e"><code>358e751</code></a> Detect warnings in CI</li>
<li><a href="61ddd087b6"><code>61ddd08</code></a> Track raw pointers in miri CI run</li>
<li><a href="c5d644a3fa"><code>c5d644a</code></a> Add a miri test job in CI</li>
<li><a href="6c2e4585f2"><code>6c2e458</code></a> Declare minimum Rust version in Cargo metadata</li>
<li><a href="943c9296d4"><code>943c929</code></a> Resolve semicolon_if_nothing_returned pedantic clippy lint</li>
<li><a href="07b1c418d7"><code>07b1c41</code></a> Run clippy on test suite too</li>
<li><a href="15c588114a"><code>15c5881</code></a> Skip clippy job on pull requests</li>
<li>Additional commits viewable in <a href="https://github.com/dtolnay/dyn-clone/compare/1.0.4...1.0.5">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.4&new-version=1.0.5)](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 `BigInt` and `Number` comparison, and vice versa. Before we were removing the decimal point of the floating-point number which was causing cases like `0.000001 > 0n` (or `0n < 0.000001`) to fail.
It changes the following:
- Refreshes the vm and debugging docs to represent the current state
- Fix some bytecode trace output
- Rename a field in the `CodeBlock`
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->
This Pull Request fixes/closes #1784.
There're still a few tests failing, notably:
- `iter-set-elem-prop-non-writable` - we don't have generator functions implemented
- `calling-from-valid-1-noStrict`, `iter-map-fn-this-non-strict` - `thisArg` in non-strict mode, when undefined, should be inherited (that's what I'm guessing, I haven't confirmed this, but strict counterparts do pass with `thisArg` being `undefined`)
- `source-array-boundary`, `elements-deleted-after` - ~~Not sure yet, still investigating, but they also include thisArg, so perhaps function calling has an underlying issue?~~ Failing because `this` on the top level evaluates to an empty object instead of containing everything from the top scope
Co-authored-by: HalidOdat <halidodat@gmail.com>
This fixes a bug with the postfix increment and decrement. Before those operators would return the left-hand-side value, but the spec specifies they should return ToNumeric(left-had-side value).
Added boa examples as per issue #446
Overtaken https://github.com/boa-dev/boa/pull/634
Somehow screwed that branch up by rebasing it and losing access
pings @elasmojs
This Pull Request fixes/closes #446 .
Co-authored-by: Jason Williams <jase.williams@gmail.com>
Co-authored-by: Iban Eguia (Razican) <razican@protonmail.ch>
Co-authored-by: jasonwilliams <jase.williams@gmail.com>
Co-authored-by: jedel1043 <jedel0124@gmail.com>