Skip to content

Conversation

@sebastianjacmatt
Copy link

No description provided.

sebastianjacmatt and others added 28 commits November 27, 2025 12:04
…ntPrototype%Temporal.Instant.Prototype% as well as heap data and handles
Copy link
Member

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A partial review.

weak-refs = []
set = []
typescript = []
temporal = ["temporal_rs"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Feature is doubled.

/// 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>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Should be gated on the feature flag.

if let Value::Integer(digits_value) = digits_value
&& (0..=9).contains(&digits_value.into_i64())
{
return Ok(temporal_rs::parsers::Precision::Digit(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Maybe add a small comment regarding this fast path.

// b. Return auto.
return Ok(temporal_rs::parsers::Precision::Auto);
}
// SAFETY: not shared.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: You should be throwing an error here. "If not 'auto', throw a RangeError exception. Else, return 'auto'."

));
}
// 3. If digitsValue is not a Number, then
if !digits_value.is_number() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

Suggested change
if !digits_value.is_number() {
let Ok(digits_value) = Number::try_from(digits_value) else {

This should work to convert digitsValue into a number after this if branch; you just need to add the currently missing "throw RangeError" part inside the else.

}
// 3. If digitsValue is not a Number, then
if !digits_value.is_number() {
let scoped_digits_value = digits_value.scope(agent, gc.nogc());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: This scoping becomes unnecessary.

));
}
// 5. Let digitCount be floor(ℝ(digitsValue)).
let digit_count = digits_value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: ToNumber here is extra. Spec's R(digitsValue) means effectively digits_value.to_real(agent) which is equivalent to into_f64.


impl DurationHeapData<'_> {
pub fn default() -> Self {
todo!()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This is either dead code or will crash the program when Temporal.Duration is used :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants