Skip to content

Commit

Permalink
Post rebase fixes and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nekevss committed Sep 11, 2023
1 parent cacfc76 commit f50486f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 32 deletions.
18 changes: 0 additions & 18 deletions boa_engine/src/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,24 +437,6 @@ impl From<usize> for JsBigInt {
}
}

impl From<u128> for JsBigInt {
#[inline]
fn from(value: u128) -> Self {
Self {
inner: Rc::new(RawBigInt::from(value)),
}
}
}

impl From<i128> for JsBigInt {
#[inline]
fn from(value: i128) -> Self {
Self {
inner: Rc::new(RawBigInt::from(value)),
}
}
}

/// The error indicates that the conversion from [`f64`] to [`JsBigInt`] failed.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct TryFromF64Error;
Expand Down
10 changes: 5 additions & 5 deletions boa_engine/src/builtins/temporal/calendar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ pub trait BuiltinCalendar {
fn days_in_year(&self, args: &[JsValue], context: &mut Context<'_>) -> JsResult<JsValue>;
/// Returns the months in a year for a given calendar.
fn months_in_year(&self, args: &[JsValue], context: &mut Context<'_>) -> JsResult<JsValue>;
/// TODO: Docs
/// Returns whether a value is within a leap year according to the designated calendar.
fn in_leap_year(&self, args: &[JsValue], context: &mut Context<'_>) -> JsResult<JsValue>;
/// TODO: Docs
/// Returns the fields of the implemented calendar
fn fields(&self, args: &[JsValue], context: &mut Context<'_>) -> JsResult<JsValue>;
/// TODO: Docs
/// Merges provided fields.
fn merge_fields(&self, args: &[JsValue], context: &mut Context<'_>) -> JsResult<JsValue>;
}

Expand Down Expand Up @@ -896,9 +896,9 @@ pub(crate) fn calendar_fields(
)?;

// 3. Let iteratorRecord be ? GetIterator(fieldsArray, sync).
let iterator_record = fields_array.get_iterator(context, Some(IteratorHint::Sync), None)?;
let mut iterator_record = fields_array.get_iterator(context, Some(IteratorHint::Sync), None)?;
// 4. Return ? IteratorToListOfType(iteratorRecord, « String »).
super::iterator_to_list_of_types(&iterator_record, &[crate::value::Type::String], context)
super::iterator_to_list_of_types(&mut iterator_record, &[crate::value::Type::String], context)
}

/// 12.2.3 CalendarMergeFields ( calendar, fields, additionalFields )
Expand Down
6 changes: 3 additions & 3 deletions boa_engine/src/builtins/temporal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fn to_zero_padded_decimal_string(n: u64, min_length: usize) -> String {

// TODO: 13.1 IteratorToListOfType
pub(crate) fn iterator_to_list_of_types(
iterator: &IteratorRecord,
iterator: &mut IteratorRecord,
element_types: &[Type],
context: &mut Context<'_>,
) -> JsResult<Vec<JsValue>> {
Expand All @@ -252,9 +252,9 @@ pub(crate) fn iterator_to_list_of_types(
// 3. Repeat, while next is not false,
// a. Set next to ? IteratorStep(iteratorRecord).
// b. If next is not false, then
while let Some(next) = iterator.step(context)? {
while iterator.step(context)? {
// i. Let nextValue be ? IteratorValue(next).
let next_value = next.value(context)?;
let next_value = iterator.value(context)?;
// ii. If Type(nextValue) is not an element of elementTypes, then
if element_types.contains(&next_value.get_type()) {
// 1. Let completion be ThrowCompletion(a newly created TypeError object).
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/temporal/plain_date_time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl BuiltInConstructor for PlainDateTime {
args: &[JsValue],
context: &mut Context<'_>,
) -> JsResult<JsValue> {
todo!()
Err(JsNativeError::range().with_message("Not yet implemented.").into())
}
}

Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/temporal/plain_month_day/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl BuiltInConstructor for PlainMonthDay {
args: &[JsValue],
context: &mut Context<'_>,
) -> JsResult<JsValue> {
todo!()
Err(JsNativeError::range().with_message("Not yet implemented.").into())
}
}

Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/temporal/plain_time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
context::intrinsics::{Intrinsics, StandardConstructor, StandardConstructors},
property::Attribute,
realm::Realm,
Context, JsObject, JsResult, JsSymbol, JsValue,
Context, JsObject, JsResult, JsSymbol, JsValue, JsNativeError,
};
use boa_profiler::Profiler;

Expand Down Expand Up @@ -52,6 +52,6 @@ impl BuiltInConstructor for PlainTime {
args: &[JsValue],
context: &mut Context<'_>,
) -> JsResult<JsValue> {
todo!()
Err(JsNativeError::range().with_message("Not yet implemented.").into())
}
}
4 changes: 2 additions & 2 deletions boa_engine/src/object/builtins/jspromise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ impl JsPromise {
let state = state.clone();

FunctionObjectBuilder::new(
context,
context.realm().clone(),
NativeFunction::from_copy_closure_with_captures(
move |_, args, state, _| {
finish(state, Ok(args.get_or_undefined(0).clone()));
Expand All @@ -982,7 +982,7 @@ impl JsPromise {
let state = state.clone();

FunctionObjectBuilder::new(
context,
context.realm().clone(),
NativeFunction::from_copy_closure_with_captures(
move |_, args, state, _| {
let err = JsError::from_opaque(args.get_or_undefined(0).clone());
Expand Down

0 comments on commit f50486f

Please sign in to comment.