-
Notifications
You must be signed in to change notification settings - Fork 72
Temporal intrinsic #876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
sebastianjacmatt
wants to merge
49
commits into
trynova:main
Choose a base branch
from
sebastianjacmatt:temporal_intrinsic
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Temporal intrinsic #876
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
5477540
added temporal intrinsic
sebastianjacmatt a9a074e
Added Placeholders for InstantConstructor%Temporal.Instant% and Insta…
sebastianjacmatt 7905959
added engine and heap backing to %temporal.instant%
sebastianjacmatt 5003bb5
added data.rs
sebastianjacmatt 1efcf9d
fix errors after rebase
aapoalas c485800
cleanup
aapoalas da9f21e
create Temporal global property
aapoalas 02e8063
Temporal.Instant constructor
aapoalas 74a3139
add prototype methods
lockels 0f4472d
get it working
aapoalas a26ba27
lint
aapoalas 3ea2a37
fromEpochMillisecondswith sus gc subscoping
sebastianjacmatt b3c232c
corrected gc scoping
sebastianjacmatt 3205e8b
from_epoch_nanoseconds
sebastianjacmatt f120a69
implementation of Temporal.Instant.compare
lockels 835df63
bit of cleanup
lockels a363df6
get_epoch_milliseconds and get_epoch_nanoseconds
lockels 8f49946
add BigInt::from_i128, and add skeleton methods for Seb
lockels 9574528
add better structure to the code. introduce new modules instant_proto…
lockels c14f71f
add skeleton for the rest of Temporal.Instant implementation
lockels 6f0114b
implementation of 8.3.14 Temporal.Instant.prototype.valueOf
lockels 5f0cd73
cargo fmt and cargo clippy
lockels 82b9a74
ignore unused parameters
lockels 09274b6
implementation of 8.3.10 Temporal.Instant.prototype.equals
lockels f18bdda
immediatly scope instant after require internal slot in Instant.proto…
lockels fa28d43
added instant.proto.add/subtract along with %duration% stubs
sebastianjacmatt bffe729
properly impl to_temporal_duration along with some since&untill stuff
sebastianjacmatt e8fb97e
remove to_big_int and instead cast to i128 in to_temporal_partial_dur…
sebastianjacmatt bddb79d
cargo fmt
sebastianjacmatt 49db0c9
some work on instant.prototype.round
lockels 9046465
use PropertyKey instead of String<'static> as key
lockels 91c8886
bring up test262 test passing results, bug fixing, refactoring, groun…
lockels 186855c
fix oversights in previous commit
lockels fed7aa8
difference_temporal_instant and uncompleted get_difference_settings
sebastianjacmatt 01baa0b
awful awful code so far, WIP
lockels f9a5f11
Instant.prototype.round tests now passing
lockels 9aa1db5
add comment
lockels 1fc9a5f
added proper duration backing
sebastianjacmatt 0abe18f
instant.proto.to_string
sebastianjacmatt 6c9f50b
small check fixes
sebastianjacmatt 61b8e1d
fix: finish Temporal.Instant.prototype.toString impl
aapoalas 20d4473
fix errors from rebase
aapoalas 2055b9d
plain_time constructor and prototype structs and stubs
sebastianjacmatt 6c24376
Merge pull request #9 from sebastianjacmatt/temporal_duration_stubs
sebastianjacmatt 69f41dc
to_local_string, to_json
sebastianjacmatt dc832a3
cargo fmt
sebastianjacmatt 32c7aab
_ in front of unused
sebastianjacmatt 7b151b2
remove references to plaintime object. since it is outside of the sco…
lockels 8846580
change property capapcity of temporal 4->3
lockels File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1563,6 +1563,36 @@ pub(crate) fn try_to_index<'a>( | |
| js_result_into_try(validate_index(agent, integer, gc)) | ||
| } | ||
|
|
||
| /// [14.5.1.1 ToIntegerIfIntegral ( argument )](https://tc39.es/proposal-temporal/#sec-tointegerifintegral) | ||
| /// The abstract operation ToIntegerIfIntegral takes argument argument | ||
| /// (an ECMAScript language value) and returns either a normal completion containing | ||
| /// an integer or a throw completion. | ||
| /// It converts argument to an integer representing its Number value, | ||
| /// or throws a RangeError when that value is not integral. | ||
| pub(crate) fn to_integer_if_integral<'gc>( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: Should be gated on the feature flag. |
||
| agent: &mut Agent, | ||
| argument: Value, | ||
| mut gc: GcScope<'gc, '_>, | ||
| ) -> JsResult<'gc, Number<'gc>> { | ||
| let argument = argument.bind(gc.nogc()); | ||
| // 1. Let number be ? ToNumber(argument). | ||
| let number = to_number(agent, argument.unbind(), gc.reborrow()) | ||
| .unbind()? | ||
| .bind(gc.nogc()); | ||
| // 2. If number is not an integral Number, throw a RangeError exception. | ||
| if !number.is_integer(agent) { | ||
| Err(agent.throw_exception_with_static_message( | ||
| ExceptionType::RangeError, | ||
| "Number must be integral", | ||
| gc.into_nogc(), | ||
| )) | ||
| } else { | ||
| // 3. Return ℝ(number). | ||
| // Ok(number.into_i64(agent)) // TODO: more performant | ||
| Ok(number.unbind()) | ||
| } | ||
| } | ||
|
|
||
| /// Helper function to check if a `char` is trimmable. | ||
| /// | ||
| /// Copied from Boa JS engine. Source https://github.com/boa-dev/boa/blob/183e763c32710e4e3ea83ba762cf815b7a89cd1f/core/string/src/lib.rs#L51 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Feature is doubled.