From 3e8493c6cc77e9af491741f7c0229b9f857b5d0a Mon Sep 17 00:00:00 2001 From: Iban Eguia Moraza Date: Fri, 20 May 2022 23:12:07 +0200 Subject: [PATCH] Fixing build for changes in clippy for Rust 1.61 --- boa_engine/src/builtins/intl/tests.rs | 60 +- boa_engine/src/builtins/typed_array/mod.rs | 24 +- boa_engine/src/lib.rs | 3 +- boa_engine/src/syntax/ast/keyword.rs | 4 +- .../src/syntax/ast/node/declaration/mod.rs | 30 +- boa_engine/src/value/equality.rs | 10 +- boa_engine/src/value/integer.rs | 16 +- boa_engine/src/value/mod.rs | 79 ++- boa_engine/src/vm/opcode.rs | 564 +++++++++--------- boa_tester/src/main.rs | 2 +- 10 files changed, 389 insertions(+), 403 deletions(-) diff --git a/boa_engine/src/builtins/intl/tests.rs b/boa_engine/src/builtins/intl/tests.rs index 7a125b108a7..388af54d086 100644 --- a/boa_engine/src/builtins/intl/tests.rs +++ b/boa_engine/src/builtins/intl/tests.rs @@ -28,7 +28,7 @@ fn best_avail_loc() { ); let locale_part = "fr".to_string(); - let no_extensions_locale = JsString::new(locale_part.clone() + &"-CA".to_string()); + let no_extensions_locale = JsString::new(locale_part.clone() + "-CA"); let available_locales = vec![JsString::new(locale_part.clone())]; assert_eq!( best_available_locale(&available_locales, &no_extensions_locale,), @@ -38,7 +38,7 @@ fn best_avail_loc() { let ja_kana_t = JsString::new("ja-Kana-JP-t"); let ja_kana = JsString::new("ja-Kana-JP"); let no_extensions_locale = JsString::new("ja-Kana-JP-t-it-latn-it"); - let available_locales = vec![ja_kana_t.clone(), ja_kana.clone()]; + let available_locales = vec![ja_kana_t, ja_kana.clone()]; assert_eq!( best_available_locale(&available_locales, &no_extensions_locale,), Some(ja_kana) @@ -108,7 +108,7 @@ fn insert_unicode_ext() { fn uni_ext_comp() { let ext = JsString::new("-u-ca-japanese-hc-h12"); let components = unicode_extension_components(&ext); - assert_eq!(components.attributes.is_empty(), true); + assert!(components.attributes.is_empty()); assert_eq!(components.keywords.len(), 2); assert_eq!(components.keywords[0].key, "ca"); assert_eq!(components.keywords[0].value, "japanese"); @@ -126,7 +126,7 @@ fn uni_ext_comp() { let ext = JsString::new("-u-ca-buddhist-kk-nu-thai"); let components = unicode_extension_components(&ext); - assert_eq!(components.attributes.is_empty(), true); + assert!(components.attributes.is_empty()); assert_eq!(components.keywords.len(), 3); assert_eq!(components.keywords[0].key, "ca"); assert_eq!(components.keywords[0].value, "buddhist"); @@ -137,7 +137,7 @@ fn uni_ext_comp() { let ext = JsString::new("-u-ca-islamic-civil"); let components = unicode_extension_components(&ext); - assert_eq!(components.attributes.is_empty(), true); + assert!(components.attributes.is_empty()); assert_eq!(components.keywords.len(), 1); assert_eq!(components.keywords[0].key, "ca"); assert_eq!(components.keywords[0].value, "islamic-civil"); @@ -167,7 +167,7 @@ fn locale_resolution() { ); assert_eq!(locale_record.locale, default_locale()); assert_eq!(locale_record.data_locale, default_locale()); - assert_eq!(locale_record.properties.is_empty(), true); + assert!(locale_record.properties.is_empty()); // test best fit let available_locales = Vec::::new(); @@ -189,7 +189,7 @@ fn locale_resolution() { ); assert_eq!(locale_record.locale, default_locale()); assert_eq!(locale_record.data_locale, default_locale()); - assert_eq!(locale_record.properties.is_empty(), true); + assert!(locale_record.properties.is_empty()); // available: [es-ES], requested: [es-ES] let available_locales = vec![JsString::new("es-ES")]; @@ -211,7 +211,7 @@ fn locale_resolution() { ); assert_eq!(locale_record.locale, "es-ES"); assert_eq!(locale_record.data_locale, "es-ES"); - assert_eq!(locale_record.properties.is_empty(), true); + assert!(locale_record.properties.is_empty()); // available: [zh-CN], requested: [] let available_locales = vec![JsString::new("zh-CN")]; @@ -233,7 +233,7 @@ fn locale_resolution() { ); assert_eq!(locale_record.locale, default_locale()); assert_eq!(locale_record.data_locale, default_locale()); - assert_eq!(locale_record.properties.is_empty(), true); + assert!(locale_record.properties.is_empty()); } #[test] @@ -319,7 +319,7 @@ fn get_opt() { let other_locale_str = JsString::new("de-DE"); let values = vec![other_locale_str]; options_obj - .set("Locale", locale_value.clone(), true, &mut context) + .set("Locale", locale_value, true, &mut context) .expect("Setting a property should not fail"); let option_type = GetOptionType::String; let get_option_result = get_option( @@ -330,7 +330,7 @@ fn get_opt() { &fallback, &mut context, ); - assert_eq!(get_option_result.is_err(), true); + assert!(get_option_result.is_err()); let value = JsValue::undefined(); let minimum = 1.0; @@ -345,21 +345,21 @@ fn get_opt() { let maximum = 10.0; let fallback = Some(5.0); let get_option_result = default_number_option(&value, minimum, maximum, fallback, &mut context); - assert_eq!(get_option_result.is_err(), true); + assert!(get_option_result.is_err()); let value = JsValue::new(0); let minimum = 1.0; let maximum = 10.0; let fallback = Some(5.0); let get_option_result = default_number_option(&value, minimum, maximum, fallback, &mut context); - assert_eq!(get_option_result.is_err(), true); + assert!(get_option_result.is_err()); let value = JsValue::new(11); let minimum = 1.0; let maximum = 10.0; let fallback = Some(5.0); let get_option_result = default_number_option(&value, minimum, maximum, fallback, &mut context); - assert_eq!(get_option_result.is_err(), true); + assert!(get_option_result.is_err()); let value_f64 = 7.0; let value = JsValue::new(value_f64); @@ -375,14 +375,8 @@ fn get_opt() { let maximum = 10.0; let fallback_val = 5.0; let fallback = Some(fallback_val); - let get_option_result = get_number_option( - &options, - &property, - minimum, - maximum, - fallback, - &mut context, - ); + let get_option_result = + get_number_option(&options, property, minimum, maximum, fallback, &mut context); assert_eq!(get_option_result, Ok(fallback)); let options = JsObject::empty(); @@ -390,19 +384,13 @@ fn get_opt() { let value = JsValue::new(value_f64); let property = "fractionalSecondDigits"; options - .set(property, value.clone(), true, &mut context) + .set(property, value, true, &mut context) .expect("Setting a property should not fail"); let minimum = 1.0; let maximum = 10.0; let fallback = Some(5.0); - let get_option_result = get_number_option( - &options, - &property, - minimum, - maximum, - fallback, - &mut context, - ); + let get_option_result = + get_number_option(&options, property, minimum, maximum, fallback, &mut context); assert_eq!(get_option_result, Ok(Some(value_f64))); } @@ -420,7 +408,7 @@ fn to_date_time_opts() { &DateTimeReqs::Date, &mut context, ); - assert_eq!(date_time_opts.is_err(), true); + assert!(date_time_opts.is_err()); let options_obj = JsObject::empty(); options_obj @@ -432,7 +420,7 @@ fn to_date_time_opts() { &DateTimeReqs::Time, &mut context, ); - assert_eq!(date_time_opts.is_err(), true); + assert!(date_time_opts.is_err()); let date_time_opts = to_date_time_options( &JsValue::undefined(), @@ -453,7 +441,7 @@ fn to_date_time_opts() { ); assert_eq!( date_time_opts.get("day", &mut context), - Ok(numeric_jsstring.clone()) + Ok(numeric_jsstring) ); let date_time_opts = to_date_time_options( @@ -475,7 +463,7 @@ fn to_date_time_opts() { ); assert_eq!( date_time_opts.get("second", &mut context), - Ok(numeric_jsstring.clone()) + Ok(numeric_jsstring) ); let date_time_opts = to_date_time_options( @@ -509,6 +497,6 @@ fn to_date_time_opts() { ); assert_eq!( date_time_opts.get("second", &mut context), - Ok(numeric_jsstring.clone()) + Ok(numeric_jsstring) ); } diff --git a/boa_engine/src/builtins/typed_array/mod.rs b/boa_engine/src/builtins/typed_array/mod.rs index edffcfedb0a..1b30d9a9580 100644 --- a/boa_engine/src/builtins/typed_array/mod.rs +++ b/boa_engine/src/builtins/typed_array/mod.rs @@ -3438,22 +3438,22 @@ impl TypedArrayKind { #[inline] pub(crate) const fn name(&self) -> &str { match self { - TypedArrayKind::Int8 => "Int8Array", - TypedArrayKind::Uint8 => "Uint8Array", - TypedArrayKind::Uint8Clamped => "Uint8ClampedArray", - TypedArrayKind::Int16 => "Int16Array", - TypedArrayKind::Uint16 => "Uint16Array", - TypedArrayKind::Int32 => "Int32Array", - TypedArrayKind::Uint32 => "Uint32Array", - TypedArrayKind::BigInt64 => "BigInt64Array", - TypedArrayKind::BigUint64 => "BigUint64Array", - TypedArrayKind::Float32 => "Float32Array", - TypedArrayKind::Float64 => "Float64Array", + Self::Int8 => "Int8Array", + Self::Uint8 => "Uint8Array", + Self::Uint8Clamped => "Uint8ClampedArray", + Self::Int16 => "Int16Array", + Self::Uint16 => "Uint16Array", + Self::Int32 => "Int32Array", + Self::Uint32 => "Uint32Array", + Self::BigInt64 => "BigInt64Array", + Self::BigUint64 => "BigUint64Array", + Self::Float32 => "Float32Array", + Self::Float64 => "Float64Array", } } pub(crate) fn is_big_int_element_type(self) -> bool { - matches!(self, TypedArrayKind::BigUint64 | TypedArrayKind::BigInt64) + matches!(self, Self::BigUint64 | Self::BigInt64) } } diff --git a/boa_engine/src/lib.rs b/boa_engine/src/lib.rs index 9db8165bf50..65d128ec149 100644 --- a/boa_engine/src/lib.rs +++ b/boa_engine/src/lib.rs @@ -26,7 +26,6 @@ clippy::all, clippy::cast_lossless, clippy::redundant_closure_for_method_calls, - clippy::use_self, clippy::unnested_or_patterns, clippy::trivially_copy_pass_by_ref, clippy::needless_pass_by_value, @@ -49,6 +48,7 @@ nonstandard_style, )] #![allow( + clippy::use_self, // TODO: deny once false positives are fixed clippy::module_name_repetitions, clippy::cast_possible_truncation, clippy::cast_sign_loss, @@ -99,7 +99,6 @@ pub use crate::{ }; /// The result of a Javascript expression is represented like this so it can succeed (`Ok`) or fail (`Err`) -#[must_use] pub type JsResult = StdResult; /// Execute the code using an existing `Context`. diff --git a/boa_engine/src/syntax/ast/keyword.rs b/boa_engine/src/syntax/ast/keyword.rs index 109c88de320..16389db0fbd 100644 --- a/boa_engine/src/syntax/ast/keyword.rs +++ b/boa_engine/src/syntax/ast/keyword.rs @@ -485,8 +485,8 @@ impl Keyword { /// Gets the keyword as a binary operation, if this keyword is the `in` keyword. pub fn as_binop(self) -> Option { match self { - Keyword::In => Some(BinOp::Comp(CompOp::In)), - Keyword::InstanceOf => Some(BinOp::Comp(CompOp::InstanceOf)), + Self::In => Some(BinOp::Comp(CompOp::In)), + Self::InstanceOf => Some(BinOp::Comp(CompOp::InstanceOf)), _ => None, } } diff --git a/boa_engine/src/syntax/ast/node/declaration/mod.rs b/boa_engine/src/syntax/ast/node/declaration/mod.rs index c668f7d00ea..4de2b26572d 100644 --- a/boa_engine/src/syntax/ast/node/declaration/mod.rs +++ b/boa_engine/src/syntax/ast/node/declaration/mod.rs @@ -546,8 +546,8 @@ pub enum BindingPatternTypeObject { impl ToInternedString for BindingPatternTypeObject { fn to_interned_string(&self, interner: &Interner) -> String { match self { - BindingPatternTypeObject::Empty => String::new(), - BindingPatternTypeObject::SingleName { + Self::Empty => String::new(), + Self::SingleName { ident, property_name, default_init, @@ -576,18 +576,18 @@ impl ToInternedString for BindingPatternTypeObject { } buf } - BindingPatternTypeObject::RestProperty { + Self::RestProperty { ident: property_name, excluded_keys: _, } => { format!(" ... {}", interner.resolve_expect(*property_name)) } - BindingPatternTypeObject::RestGetConstField { + Self::RestGetConstField { get_const_field, .. } => { format!(" ... {}", get_const_field.to_interned_string(interner)) } - BindingPatternTypeObject::BindingPattern { + Self::BindingPattern { ident: property_name, pattern, default_init, @@ -733,9 +733,9 @@ pub enum BindingPatternTypeArray { impl ToInternedString for BindingPatternTypeArray { fn to_interned_string(&self, interner: &Interner) -> String { match self { - BindingPatternTypeArray::Empty => String::new(), - BindingPatternTypeArray::Elision => " ".to_owned(), - BindingPatternTypeArray::SingleName { + Self::Empty => String::new(), + Self::Elision => " ".to_owned(), + Self::SingleName { ident, default_init, } => { @@ -745,25 +745,25 @@ impl ToInternedString for BindingPatternTypeArray { } buf } - BindingPatternTypeArray::GetField { get_field } => { + Self::GetField { get_field } => { format!(" {}", get_field.to_interned_string(interner)) } - BindingPatternTypeArray::GetConstField { get_const_field } => { + Self::GetConstField { get_const_field } => { format!(" {}", get_const_field.to_interned_string(interner)) } - BindingPatternTypeArray::BindingPattern { pattern } => { + Self::BindingPattern { pattern } => { format!(" {}", pattern.to_interned_string(interner)) } - BindingPatternTypeArray::SingleNameRest { ident } => { + Self::SingleNameRest { ident } => { format!(" ... {}", interner.resolve_expect(*ident)) } - BindingPatternTypeArray::GetFieldRest { get_field } => { + Self::GetFieldRest { get_field } => { format!(" ... {}", get_field.to_interned_string(interner)) } - BindingPatternTypeArray::GetConstFieldRest { get_const_field } => { + Self::GetConstFieldRest { get_const_field } => { format!(" ... {}", get_const_field.to_interned_string(interner)) } - BindingPatternTypeArray::BindingPatternRest { pattern } => { + Self::BindingPatternRest { pattern } => { format!(" ... {}", pattern.to_interned_string(interner)) } } diff --git a/boa_engine/src/value/equality.rs b/boa_engine/src/value/equality.rs index 07870915d31..c7d4d65235c 100644 --- a/boa_engine/src/value/equality.rs +++ b/boa_engine/src/value/equality.rs @@ -189,11 +189,11 @@ impl JsValue { fn same_value_non_numeric(x: &Self, y: &Self) -> bool { debug_assert!(x.get_type() == y.get_type()); match (x, y) { - (JsValue::Null, JsValue::Null) | (JsValue::Undefined, JsValue::Undefined) => true, - (JsValue::String(ref x), JsValue::String(ref y)) => x == y, - (JsValue::Boolean(x), JsValue::Boolean(y)) => x == y, - (JsValue::Object(ref x), JsValue::Object(ref y)) => JsObject::equals(x, y), - (JsValue::Symbol(ref x), JsValue::Symbol(ref y)) => x == y, + (Self::Null, Self::Null) | (Self::Undefined, Self::Undefined) => true, + (Self::String(ref x), Self::String(ref y)) => x == y, + (Self::Boolean(x), Self::Boolean(y)) => x == y, + (Self::Object(ref x), Self::Object(ref y)) => JsObject::equals(x, y), + (Self::Symbol(ref x), Self::Symbol(ref y)) => x == y, _ => false, } } diff --git a/boa_engine/src/value/integer.rs b/boa_engine/src/value/integer.rs index afc25ff0910..d4a1b281331 100644 --- a/boa_engine/src/value/integer.rs +++ b/boa_engine/src/value/integer.rs @@ -15,16 +15,16 @@ impl IntegerOrInfinity { assert!(min <= max); match self { - IntegerOrInfinity::Integer(i) => i.clamp(min, max), - IntegerOrInfinity::PositiveInfinity => max, - IntegerOrInfinity::NegativeInfinity => min, + Self::Integer(i) => i.clamp(min, max), + Self::PositiveInfinity => max, + Self::NegativeInfinity => min, } } /// Gets the wrapped `i64` if the variant is an `Integer`. pub fn as_integer(self) -> Option { match self { - IntegerOrInfinity::Integer(i) => Some(i), + Self::Integer(i) => Some(i), _ => None, } } @@ -33,7 +33,7 @@ impl IntegerOrInfinity { impl PartialEq for IntegerOrInfinity { fn eq(&self, other: &i64) -> bool { match self { - IntegerOrInfinity::Integer(i) => i == other, + Self::Integer(i) => i == other, _ => false, } } @@ -51,9 +51,9 @@ impl PartialEq for i64 { impl PartialOrd for IntegerOrInfinity { fn partial_cmp(&self, other: &i64) -> Option { match self { - IntegerOrInfinity::PositiveInfinity => Some(Ordering::Greater), - IntegerOrInfinity::Integer(i) => i.partial_cmp(other), - IntegerOrInfinity::NegativeInfinity => Some(Ordering::Less), + Self::PositiveInfinity => Some(Ordering::Greater), + Self::Integer(i) => i.partial_cmp(other), + Self::NegativeInfinity => Some(Ordering::Less), } } } diff --git a/boa_engine/src/value/mod.rs b/boa_engine/src/value/mod.rs index 2fd12402887..509249529f9 100644 --- a/boa_engine/src/value/mod.rs +++ b/boa_engine/src/value/mod.rs @@ -278,7 +278,6 @@ impl JsValue { /// [spec]: https://tc39.es/ecma262/#sec-toboolean pub fn to_boolean(&self) -> bool { match *self { - Self::Undefined | Self::Null => false, Self::Symbol(_) | Self::Object(_) => true, Self::String(ref s) if !s.is_empty() => true, Self::Rational(n) if n != 0.0 && !n.is_nan() => true, @@ -387,9 +386,9 @@ impl JsValue { /// [spec]: https://tc39.es/ecma262/#sec-tobigint pub fn to_bigint(&self, context: &mut Context) -> JsResult { match self { - JsValue::Null => context.throw_type_error("cannot convert null to a BigInt"), - JsValue::Undefined => context.throw_type_error("cannot convert undefined to a BigInt"), - JsValue::String(ref string) => { + Self::Null => context.throw_type_error("cannot convert null to a BigInt"), + Self::Undefined => context.throw_type_error("cannot convert undefined to a BigInt"), + Self::String(ref string) => { if let Some(value) = JsBigInt::from_string(string) { Ok(value) } else { @@ -398,17 +397,17 @@ impl JsValue { )) } } - JsValue::Boolean(true) => Ok(JsBigInt::one()), - JsValue::Boolean(false) => Ok(JsBigInt::zero()), - JsValue::Integer(_) | JsValue::Rational(_) => { + Self::Boolean(true) => Ok(JsBigInt::one()), + Self::Boolean(false) => Ok(JsBigInt::zero()), + Self::Integer(_) | Self::Rational(_) => { context.throw_type_error("cannot convert Number to a BigInt") } - JsValue::BigInt(b) => Ok(b.clone()), - JsValue::Object(_) => { + Self::BigInt(b) => Ok(b.clone()), + Self::Object(_) => { let primitive = self.to_primitive(context, PreferredType::Number)?; primitive.to_bigint(context) } - JsValue::Symbol(_) => context.throw_type_error("cannot convert Symbol to a BigInt"), + Self::Symbol(_) => context.throw_type_error("cannot convert Symbol to a BigInt"), } } @@ -439,15 +438,15 @@ impl JsValue { /// This function is equivalent to `String(value)` in JavaScript. pub fn to_string(&self, context: &mut Context) -> JsResult { match self { - JsValue::Null => Ok("null".into()), - JsValue::Undefined => Ok("undefined".into()), - JsValue::Boolean(boolean) => Ok(boolean.to_string().into()), - JsValue::Rational(rational) => Ok(Number::to_native_string(*rational).into()), - JsValue::Integer(integer) => Ok(integer.to_string().into()), - JsValue::String(string) => Ok(string.clone()), - JsValue::Symbol(_) => context.throw_type_error("can't convert symbol to string"), - JsValue::BigInt(ref bigint) => Ok(bigint.to_string().into()), - JsValue::Object(_) => { + Self::Null => Ok("null".into()), + Self::Undefined => Ok("undefined".into()), + Self::Boolean(boolean) => Ok(boolean.to_string().into()), + Self::Rational(rational) => Ok(Number::to_native_string(*rational).into()), + Self::Integer(integer) => Ok(integer.to_string().into()), + Self::String(string) => Ok(string.clone()), + Self::Symbol(_) => context.throw_type_error("can't convert symbol to string"), + Self::BigInt(ref bigint) => Ok(bigint.to_string().into()), + Self::Object(_) => { let primitive = self.to_primitive(context, PreferredType::String)?; primitive.to_string(context) } @@ -461,31 +460,31 @@ impl JsValue { /// See: pub fn to_object(&self, context: &mut Context) -> JsResult { match self { - JsValue::Undefined | JsValue::Null => { + Self::Undefined | Self::Null => { context.throw_type_error("cannot convert 'null' or 'undefined' to object") } - JsValue::Boolean(boolean) => { + Self::Boolean(boolean) => { let prototype = context.intrinsics().constructors().boolean().prototype(); Ok(JsObject::from_proto_and_data( prototype, ObjectData::boolean(*boolean), )) } - JsValue::Integer(integer) => { + Self::Integer(integer) => { let prototype = context.intrinsics().constructors().number().prototype(); Ok(JsObject::from_proto_and_data( prototype, ObjectData::number(f64::from(*integer)), )) } - JsValue::Rational(rational) => { + Self::Rational(rational) => { let prototype = context.intrinsics().constructors().number().prototype(); Ok(JsObject::from_proto_and_data( prototype, ObjectData::number(*rational), )) } - JsValue::String(ref string) => { + Self::String(ref string) => { let prototype = context.intrinsics().constructors().string().prototype(); let object = @@ -501,14 +500,14 @@ impl JsValue { ); Ok(object) } - JsValue::Symbol(ref symbol) => { + Self::Symbol(ref symbol) => { let prototype = context.intrinsics().constructors().symbol().prototype(); Ok(JsObject::from_proto_and_data( prototype, ObjectData::symbol(symbol.clone()), )) } - JsValue::BigInt(ref bigint) => { + Self::BigInt(ref bigint) => { let prototype = context .intrinsics() .constructors() @@ -519,7 +518,7 @@ impl JsValue { ObjectData::big_int(bigint.clone()), )) } - JsValue::Object(jsobject) => Ok(jsobject.clone()), + Self::Object(jsobject) => Ok(jsobject.clone()), } } @@ -529,12 +528,12 @@ impl JsValue { pub fn to_property_key(&self, context: &mut Context) -> JsResult { Ok(match self { // Fast path: - JsValue::String(string) => string.clone().into(), - JsValue::Symbol(symbol) => symbol.clone().into(), + Self::String(string) => string.clone().into(), + Self::Symbol(symbol) => symbol.clone().into(), // Slow path: _ => match self.to_primitive(context, PreferredType::String)? { - JsValue::String(ref string) => string.clone().into(), - JsValue::Symbol(ref symbol) => symbol.clone().into(), + Self::String(ref string) => string.clone().into(), + Self::Symbol(ref symbol) => symbol.clone().into(), primitive => primitive.to_string(context)?.into(), }, }) @@ -853,15 +852,15 @@ impl JsValue { /// See: pub fn to_number(&self, context: &mut Context) -> JsResult { match *self { - JsValue::Null => Ok(0.0), - JsValue::Undefined => Ok(f64::NAN), - JsValue::Boolean(b) => Ok(if b { 1.0 } else { 0.0 }), - JsValue::String(ref string) => Ok(string.string_to_number()), - JsValue::Rational(number) => Ok(number), - JsValue::Integer(integer) => Ok(f64::from(integer)), - JsValue::Symbol(_) => context.throw_type_error("argument must not be a symbol"), - JsValue::BigInt(_) => context.throw_type_error("argument must not be a bigint"), - JsValue::Object(_) => { + Self::Null => Ok(0.0), + Self::Undefined => Ok(f64::NAN), + Self::Boolean(b) => Ok(if b { 1.0 } else { 0.0 }), + Self::String(ref string) => Ok(string.string_to_number()), + Self::Rational(number) => Ok(number), + Self::Integer(integer) => Ok(f64::from(integer)), + Self::Symbol(_) => context.throw_type_error("argument must not be a symbol"), + Self::BigInt(_) => context.throw_type_error("argument must not be a bigint"), + Self::Object(_) => { let primitive = self.to_primitive(context, PreferredType::Number)?; primitive.to_number(context) } diff --git a/boa_engine/src/vm/opcode.rs b/boa_engine/src/vm/opcode.rs index 7523c2e9d1b..08e6c488935 100644 --- a/boa_engine/src/vm/opcode.rs +++ b/boa_engine/src/vm/opcode.rs @@ -1059,294 +1059,294 @@ impl Opcode { pub fn as_str(self) -> &'static str { match self { - Opcode::Pop => "Pop", - Opcode::Dup => "Dup", - Opcode::Swap => "Swap", - Opcode::PushZero => "PushZero", - Opcode::PushOne => "PushOne", - Opcode::PushInt8 => "PushInt8", - Opcode::PushInt16 => "PushInt16", - Opcode::PushInt32 => "PushInt32", - Opcode::PushRational => "PushRational", - Opcode::PushNaN => "PushNaN", - Opcode::PushPositiveInfinity => "PushPositiveInfinity", - Opcode::PushNegativeInfinity => "PushNegativeInfinity", - Opcode::PushNull => "PushNull", - Opcode::PushTrue => "PushTrue", - Opcode::PushFalse => "PushFalse", - Opcode::PushUndefined => "PushUndefined", - Opcode::PushLiteral => "PushLiteral", - Opcode::PushEmptyObject => "PushEmptyObject", - Opcode::PushClassPrototype => "PushClassPrototype", - Opcode::PushNewArray => "PushNewArray", - Opcode::PushValueToArray => "PushValueToArray", - Opcode::PushElisionToArray => "PushElisionToArray", - Opcode::PushIteratorToArray => "PushIteratorToArray", - Opcode::Add => "Add", - Opcode::Sub => "Sub", - Opcode::Div => "Div", - Opcode::Mul => "Mul", - Opcode::Mod => "Mod", - Opcode::Pow => "Pow", - Opcode::ShiftRight => "ShiftRight", - Opcode::ShiftLeft => "ShiftLeft", - Opcode::UnsignedShiftRight => "UnsignedShiftRight", - Opcode::BitOr => "BitOr", - Opcode::BitAnd => "BitAnd", - Opcode::BitXor => "BitXor", - Opcode::BitNot => "BitNot", - Opcode::In => "In", - Opcode::Eq => "Eq", - Opcode::StrictEq => "StrictEq", - Opcode::NotEq => "NotEq", - Opcode::StrictNotEq => "StrictNotEq", - Opcode::GreaterThan => "GreaterThan", - Opcode::GreaterThanOrEq => "GreaterThanOrEq", - Opcode::LessThan => "LessThan", - Opcode::LessThanOrEq => "LessThanOrEq", - Opcode::InstanceOf => "InstanceOf", - Opcode::TypeOf => "TypeOf", - Opcode::Void => "Void", - Opcode::LogicalNot => "LogicalNot", - Opcode::LogicalAnd => "LogicalAnd", - Opcode::LogicalOr => "LogicalOr", - Opcode::Coalesce => "Coalesce", - Opcode::Pos => "Pos", - Opcode::Neg => "Neg", - Opcode::Inc => "Inc", - Opcode::IncPost => "IncPost", - Opcode::Dec => "Dec", - Opcode::DecPost => "DecPost", - Opcode::DefInitArg => "DefInitArg", - Opcode::DefVar => "DefVar", - Opcode::DefInitVar => "DefInitVar", - Opcode::DefLet => "DefLet", - Opcode::DefInitLet => "DefInitLet", - Opcode::DefInitConst => "DefInitConst", - Opcode::GetName => "GetName", - Opcode::GetNameOrUndefined => "GetNameOrUndefined", - Opcode::SetName => "SetName", - Opcode::GetPropertyByName => "GetPropertyByName", - Opcode::GetPropertyByValue => "GetPropertyByValue", - Opcode::SetPropertyByName => "SetPropertyByName", - Opcode::DefineOwnPropertyByName => "DefineOwnPropertyByName", - Opcode::DefineClassMethodByName => "DefineClassMethodByName", - Opcode::SetPropertyByValue => "SetPropertyByValue", - Opcode::DefineOwnPropertyByValue => "DefineOwnPropertyByValue", - Opcode::DefineClassMethodByValue => "DefineClassMethodByValue", - Opcode::SetPropertyGetterByName => "SetPropertyGetterByName", - Opcode::DefineClassGetterByName => "DefineClassGetterByName", - Opcode::SetPropertyGetterByValue => "SetPropertyGetterByValue", - Opcode::DefineClassGetterByValue => "DefineClassGetterByValue", - Opcode::SetPropertySetterByName => "SetPropertySetterByName", - Opcode::DefineClassSetterByName => "DefineClassSetterByName", - Opcode::SetPropertySetterByValue => "SetPropertySetterByValue", - Opcode::DefineClassSetterByValue => "DefineClassSetterByValue", - Opcode::SetPrivateValue => "SetPrivateValue", - Opcode::SetPrivateSetter => "SetPrivateSetter", - Opcode::SetPrivateGetter => "SetPrivateGetter", - Opcode::GetPrivateField => "GetPrivateByName", - Opcode::PushClassComputedFieldName => "PushClassComputedFieldName", - Opcode::DeletePropertyByName => "DeletePropertyByName", - Opcode::DeletePropertyByValue => "DeletePropertyByValue", - Opcode::CopyDataProperties => "CopyDataProperties", - Opcode::ToPropertyKey => "ToPropertyKey", - Opcode::Jump => "Jump", - Opcode::JumpIfFalse => "JumpIfFalse", - Opcode::JumpIfNotUndefined => "JumpIfNotUndefined", - Opcode::Throw => "Throw", - Opcode::TryStart => "TryStart", - Opcode::TryEnd => "TryEnd", - Opcode::CatchStart => "CatchStart", - Opcode::CatchEnd => "CatchEnd", - Opcode::CatchEnd2 => "CatchEnd2", - Opcode::FinallyStart => "FinallyStart", - Opcode::FinallyEnd => "FinallyEnd", - Opcode::FinallySetJump => "FinallySetJump", - Opcode::ToBoolean => "ToBoolean", - Opcode::This => "This", - Opcode::Case => "Case", - Opcode::Default => "Default", - Opcode::GetFunction => "GetFunction", - Opcode::GetGenerator => "GetGenerator", - Opcode::CallEval => "CallEval", - Opcode::CallEvalWithRest => "CallEvalWithRest", - Opcode::Call => "Call", - Opcode::CallWithRest => "CallWithRest", - Opcode::New => "New", - Opcode::NewWithRest => "NewWithRest", - Opcode::Return => "Return", - Opcode::PushDeclarativeEnvironment => "PushDeclarativeEnvironment", - Opcode::PushFunctionEnvironment => "PushFunctionEnvironment", - Opcode::PopEnvironment => "PopEnvironment", - Opcode::LoopStart => "LoopStart", - Opcode::LoopContinue => "LoopContinue", - Opcode::LoopEnd => "LoopEnd", - Opcode::ForInLoopInitIterator => "ForInLoopInitIterator", - Opcode::InitIterator => "InitIterator", - Opcode::IteratorNext => "IteratorNext", - Opcode::IteratorNextFull => "IteratorNextFull", - Opcode::IteratorClose => "IteratorClose", - Opcode::IteratorToArray => "IteratorToArray", - Opcode::ForInLoopNext => "ForInLoopNext", - Opcode::ConcatToString => "ConcatToString", - Opcode::RequireObjectCoercible => "RequireObjectCoercible", - Opcode::ValueNotNullOrUndefined => "ValueNotNullOrUndefined", - Opcode::RestParameterInit => "FunctionRestParameter", - Opcode::RestParameterPop => "RestParameterPop", - Opcode::PopOnReturnAdd => "PopOnReturnAdd", - Opcode::PopOnReturnSub => "PopOnReturnSub", - Opcode::Yield => "Yield", - Opcode::GeneratorNext => "GeneratorNext", - Opcode::GeneratorNextDelegate => "GeneratorNextDelegate", - Opcode::Nop => "Nop", + Self::Pop => "Pop", + Self::Dup => "Dup", + Self::Swap => "Swap", + Self::PushZero => "PushZero", + Self::PushOne => "PushOne", + Self::PushInt8 => "PushInt8", + Self::PushInt16 => "PushInt16", + Self::PushInt32 => "PushInt32", + Self::PushRational => "PushRational", + Self::PushNaN => "PushNaN", + Self::PushPositiveInfinity => "PushPositiveInfinity", + Self::PushNegativeInfinity => "PushNegativeInfinity", + Self::PushNull => "PushNull", + Self::PushTrue => "PushTrue", + Self::PushFalse => "PushFalse", + Self::PushUndefined => "PushUndefined", + Self::PushLiteral => "PushLiteral", + Self::PushEmptyObject => "PushEmptyObject", + Self::PushClassPrototype => "PushClassPrototype", + Self::PushNewArray => "PushNewArray", + Self::PushValueToArray => "PushValueToArray", + Self::PushElisionToArray => "PushElisionToArray", + Self::PushIteratorToArray => "PushIteratorToArray", + Self::Add => "Add", + Self::Sub => "Sub", + Self::Div => "Div", + Self::Mul => "Mul", + Self::Mod => "Mod", + Self::Pow => "Pow", + Self::ShiftRight => "ShiftRight", + Self::ShiftLeft => "ShiftLeft", + Self::UnsignedShiftRight => "UnsignedShiftRight", + Self::BitOr => "BitOr", + Self::BitAnd => "BitAnd", + Self::BitXor => "BitXor", + Self::BitNot => "BitNot", + Self::In => "In", + Self::Eq => "Eq", + Self::StrictEq => "StrictEq", + Self::NotEq => "NotEq", + Self::StrictNotEq => "StrictNotEq", + Self::GreaterThan => "GreaterThan", + Self::GreaterThanOrEq => "GreaterThanOrEq", + Self::LessThan => "LessThan", + Self::LessThanOrEq => "LessThanOrEq", + Self::InstanceOf => "InstanceOf", + Self::TypeOf => "TypeOf", + Self::Void => "Void", + Self::LogicalNot => "LogicalNot", + Self::LogicalAnd => "LogicalAnd", + Self::LogicalOr => "LogicalOr", + Self::Coalesce => "Coalesce", + Self::Pos => "Pos", + Self::Neg => "Neg", + Self::Inc => "Inc", + Self::IncPost => "IncPost", + Self::Dec => "Dec", + Self::DecPost => "DecPost", + Self::DefInitArg => "DefInitArg", + Self::DefVar => "DefVar", + Self::DefInitVar => "DefInitVar", + Self::DefLet => "DefLet", + Self::DefInitLet => "DefInitLet", + Self::DefInitConst => "DefInitConst", + Self::GetName => "GetName", + Self::GetNameOrUndefined => "GetNameOrUndefined", + Self::SetName => "SetName", + Self::GetPropertyByName => "GetPropertyByName", + Self::GetPropertyByValue => "GetPropertyByValue", + Self::SetPropertyByName => "SetPropertyByName", + Self::DefineOwnPropertyByName => "DefineOwnPropertyByName", + Self::DefineClassMethodByName => "DefineClassMethodByName", + Self::SetPropertyByValue => "SetPropertyByValue", + Self::DefineOwnPropertyByValue => "DefineOwnPropertyByValue", + Self::DefineClassMethodByValue => "DefineClassMethodByValue", + Self::SetPropertyGetterByName => "SetPropertyGetterByName", + Self::DefineClassGetterByName => "DefineClassGetterByName", + Self::SetPropertyGetterByValue => "SetPropertyGetterByValue", + Self::DefineClassGetterByValue => "DefineClassGetterByValue", + Self::SetPropertySetterByName => "SetPropertySetterByName", + Self::DefineClassSetterByName => "DefineClassSetterByName", + Self::SetPropertySetterByValue => "SetPropertySetterByValue", + Self::DefineClassSetterByValue => "DefineClassSetterByValue", + Self::SetPrivateValue => "SetPrivateValue", + Self::SetPrivateSetter => "SetPrivateSetter", + Self::SetPrivateGetter => "SetPrivateGetter", + Self::GetPrivateField => "GetPrivateByName", + Self::PushClassComputedFieldName => "PushClassComputedFieldName", + Self::DeletePropertyByName => "DeletePropertyByName", + Self::DeletePropertyByValue => "DeletePropertyByValue", + Self::CopyDataProperties => "CopyDataProperties", + Self::ToPropertyKey => "ToPropertyKey", + Self::Jump => "Jump", + Self::JumpIfFalse => "JumpIfFalse", + Self::JumpIfNotUndefined => "JumpIfNotUndefined", + Self::Throw => "Throw", + Self::TryStart => "TryStart", + Self::TryEnd => "TryEnd", + Self::CatchStart => "CatchStart", + Self::CatchEnd => "CatchEnd", + Self::CatchEnd2 => "CatchEnd2", + Self::FinallyStart => "FinallyStart", + Self::FinallyEnd => "FinallyEnd", + Self::FinallySetJump => "FinallySetJump", + Self::ToBoolean => "ToBoolean", + Self::This => "This", + Self::Case => "Case", + Self::Default => "Default", + Self::GetFunction => "GetFunction", + Self::GetGenerator => "GetGenerator", + Self::CallEval => "CallEval", + Self::CallEvalWithRest => "CallEvalWithRest", + Self::Call => "Call", + Self::CallWithRest => "CallWithRest", + Self::New => "New", + Self::NewWithRest => "NewWithRest", + Self::Return => "Return", + Self::PushDeclarativeEnvironment => "PushDeclarativeEnvironment", + Self::PushFunctionEnvironment => "PushFunctionEnvironment", + Self::PopEnvironment => "PopEnvironment", + Self::LoopStart => "LoopStart", + Self::LoopContinue => "LoopContinue", + Self::LoopEnd => "LoopEnd", + Self::ForInLoopInitIterator => "ForInLoopInitIterator", + Self::InitIterator => "InitIterator", + Self::IteratorNext => "IteratorNext", + Self::IteratorNextFull => "IteratorNextFull", + Self::IteratorClose => "IteratorClose", + Self::IteratorToArray => "IteratorToArray", + Self::ForInLoopNext => "ForInLoopNext", + Self::ConcatToString => "ConcatToString", + Self::RequireObjectCoercible => "RequireObjectCoercible", + Self::ValueNotNullOrUndefined => "ValueNotNullOrUndefined", + Self::RestParameterInit => "FunctionRestParameter", + Self::RestParameterPop => "RestParameterPop", + Self::PopOnReturnAdd => "PopOnReturnAdd", + Self::PopOnReturnSub => "PopOnReturnSub", + Self::Yield => "Yield", + Self::GeneratorNext => "GeneratorNext", + Self::GeneratorNextDelegate => "GeneratorNextDelegate", + Self::Nop => "Nop", } } /// Name of the profiler event for this opcode pub fn as_instruction_str(self) -> &'static str { match self { - Opcode::Pop => "INST - Pop", - Opcode::Dup => "INST - Dup", - Opcode::Swap => "INST - Swap", - Opcode::PushZero => "INST - PushZero", - Opcode::PushOne => "INST - PushOne", - Opcode::PushInt8 => "INST - PushInt8", - Opcode::PushInt16 => "INST - PushInt16", - Opcode::PushInt32 => "INST - PushInt32", - Opcode::PushRational => "INST - PushRational", - Opcode::PushNaN => "INST - PushNaN", - Opcode::PushPositiveInfinity => "INST - PushPositiveInfinity", - Opcode::PushNegativeInfinity => "INST - PushNegativeInfinity", - Opcode::PushNull => "INST - PushNull", - Opcode::PushTrue => "INST - PushTrue", - Opcode::PushFalse => "INST - PushFalse", - Opcode::PushUndefined => "INST - PushUndefined", - Opcode::PushLiteral => "INST - PushLiteral", - Opcode::PushEmptyObject => "INST - PushEmptyObject", - Opcode::PushNewArray => "INST - PushNewArray", - Opcode::PushValueToArray => "INST - PushValueToArray", - Opcode::PushElisionToArray => "INST - PushElisionToArray", - Opcode::PushIteratorToArray => "INST - PushIteratorToArray", - Opcode::Add => "INST - Add", - Opcode::Sub => "INST - Sub", - Opcode::Div => "INST - Div", - Opcode::Mul => "INST - Mul", - Opcode::Mod => "INST - Mod", - Opcode::Pow => "INST - Pow", - Opcode::ShiftRight => "INST - ShiftRight", - Opcode::ShiftLeft => "INST - ShiftLeft", - Opcode::UnsignedShiftRight => "INST - UnsignedShiftRight", - Opcode::BitOr => "INST - BitOr", - Opcode::BitAnd => "INST - BitAnd", - Opcode::BitXor => "INST - BitXor", - Opcode::BitNot => "INST - BitNot", - Opcode::In => "INST - In", - Opcode::Eq => "INST - Eq", - Opcode::StrictEq => "INST - StrictEq", - Opcode::NotEq => "INST - NotEq", - Opcode::StrictNotEq => "INST - StrictNotEq", - Opcode::GreaterThan => "INST - GreaterThan", - Opcode::GreaterThanOrEq => "INST - GreaterThanOrEq", - Opcode::LessThan => "INST - LessThan", - Opcode::LessThanOrEq => "INST - LessThanOrEq", - Opcode::InstanceOf => "INST - InstanceOf", - Opcode::TypeOf => "INST - TypeOf", - Opcode::Void => "INST - Void", - Opcode::LogicalNot => "INST - LogicalNot", - Opcode::LogicalAnd => "INST - LogicalAnd", - Opcode::LogicalOr => "INST - LogicalOr", - Opcode::Coalesce => "INST - Coalesce", - Opcode::Pos => "INST - Pos", - Opcode::Neg => "INST - Neg", - Opcode::Inc => "INST - Inc", - Opcode::IncPost => "INST - IncPost", - Opcode::Dec => "INST - Dec", - Opcode::DecPost => "INST - DecPost", - Opcode::DefInitArg => "INST - DefInitArg", - Opcode::DefVar => "INST - DefVar", - Opcode::DefInitVar => "INST - DefInitVar", - Opcode::DefLet => "INST - DefLet", - Opcode::DefInitLet => "INST - DefInitLet", - Opcode::DefInitConst => "INST - DefInitConst", - Opcode::GetName => "INST - GetName", - Opcode::GetNameOrUndefined => "INST - GetNameOrUndefined", - Opcode::SetName => "INST - SetName", - Opcode::GetPropertyByName => "INST - GetPropertyByName", - Opcode::GetPropertyByValue => "INST - GetPropertyByValue", - Opcode::SetPropertyByName => "INST - SetPropertyByName", - Opcode::DefineOwnPropertyByName => "INST - DefineOwnPropertyByName", - Opcode::SetPropertyByValue => "INST - SetPropertyByValue", - Opcode::DefineOwnPropertyByValue => "INST - DefineOwnPropertyByValue", - Opcode::SetPropertyGetterByName => "INST - SetPropertyGetterByName", - Opcode::SetPropertyGetterByValue => "INST - SetPropertyGetterByValue", - Opcode::SetPropertySetterByName => "INST - SetPropertySetterByName", - Opcode::SetPropertySetterByValue => "INST - SetPropertySetterByValue", - Opcode::DeletePropertyByName => "INST - DeletePropertyByName", - Opcode::DeletePropertyByValue => "INST - DeletePropertyByValue", - Opcode::CopyDataProperties => "INST - CopyDataProperties", - Opcode::Jump => "INST - Jump", - Opcode::JumpIfFalse => "INST - JumpIfFalse", - Opcode::JumpIfNotUndefined => "INST - JumpIfNotUndefined", - Opcode::Throw => "INST - Throw", - Opcode::TryStart => "INST - TryStart", - Opcode::TryEnd => "INST - TryEnd", - Opcode::CatchStart => "INST - CatchStart", - Opcode::CatchEnd => "INST - CatchEnd", - Opcode::CatchEnd2 => "INST - CatchEnd2", - Opcode::FinallyStart => "INST - FinallyStart", - Opcode::FinallyEnd => "INST - FinallyEnd", - Opcode::FinallySetJump => "INST - FinallySetJump", - Opcode::ToBoolean => "INST - ToBoolean", - Opcode::This => "INST - This", - Opcode::Case => "INST - Case", - Opcode::Default => "INST - Default", - Opcode::GetFunction => "INST - GetFunction", - Opcode::GetGenerator => "INST - GetGenerator", - Opcode::CallEval => "INST - CallEval", - Opcode::CallEvalWithRest => "INST - CallEvalWithRest", - Opcode::Call => "INST - Call", - Opcode::CallWithRest => "INST - CallWithRest", - Opcode::New => "INST - New", - Opcode::NewWithRest => "INST - NewWithRest", - Opcode::Return => "INST - Return", - Opcode::PushDeclarativeEnvironment => "INST - PushDeclarativeEnvironment", - Opcode::PushFunctionEnvironment => "INST - PushFunctionEnvironment", - Opcode::PopEnvironment => "INST - PopEnvironment", - Opcode::LoopStart => "INST - LoopStart", - Opcode::LoopContinue => "INST - LoopContinue", - Opcode::LoopEnd => "INST - LoopEnd", - Opcode::ForInLoopInitIterator => "INST - ForInLoopInitIterator", - Opcode::InitIterator => "INST - InitIterator", - Opcode::IteratorNext => "INST - IteratorNext", - Opcode::IteratorNextFull => "INST - IteratorNextFull", - Opcode::IteratorClose => "INST - IteratorClose", - Opcode::IteratorToArray => "INST - IteratorToArray", - Opcode::ForInLoopNext => "INST - ForInLoopNext", - Opcode::ConcatToString => "INST - ConcatToString", - Opcode::RequireObjectCoercible => "INST - RequireObjectCoercible", - Opcode::ValueNotNullOrUndefined => "INST - ValueNotNullOrUndefined", - Opcode::RestParameterInit => "INST - FunctionRestParameter", - Opcode::RestParameterPop => "INST - RestParameterPop", - Opcode::PopOnReturnAdd => "INST - PopOnReturnAdd", - Opcode::PopOnReturnSub => "INST - PopOnReturnSub", - Opcode::Yield => "INST - Yield", - Opcode::GeneratorNext => "INST - GeneratorNext", - Opcode::GeneratorNextDelegate => "INST - GeneratorNextDelegate", - Opcode::Nop => "INST - Nop", - Opcode::PushClassPrototype => "INST - PushClassPrototype", - Opcode::DefineClassMethodByName => "INST - DefineClassMethodByName", - Opcode::DefineClassMethodByValue => "INST - DefineClassMethodByValue", - Opcode::DefineClassGetterByName => "INST - DefineClassGetterByName", - Opcode::DefineClassGetterByValue => "INST - DefineClassGetterByValue", - Opcode::DefineClassSetterByName => "INST - DefineClassSetterByName", - Opcode::DefineClassSetterByValue => "INST - DefineClassSetterByValue", - Opcode::SetPrivateValue => "INST - SetPrivateValue", - Opcode::SetPrivateSetter => "INST - SetPrivateSetter", - Opcode::SetPrivateGetter => "INST - SetPrivateGetter", - Opcode::GetPrivateField => "INST - GetPrivateField", - Opcode::PushClassComputedFieldName => "INST - PushClassComputedFieldName", - Opcode::ToPropertyKey => "INST - ToPropertyKey", + Self::Pop => "INST - Pop", + Self::Dup => "INST - Dup", + Self::Swap => "INST - Swap", + Self::PushZero => "INST - PushZero", + Self::PushOne => "INST - PushOne", + Self::PushInt8 => "INST - PushInt8", + Self::PushInt16 => "INST - PushInt16", + Self::PushInt32 => "INST - PushInt32", + Self::PushRational => "INST - PushRational", + Self::PushNaN => "INST - PushNaN", + Self::PushPositiveInfinity => "INST - PushPositiveInfinity", + Self::PushNegativeInfinity => "INST - PushNegativeInfinity", + Self::PushNull => "INST - PushNull", + Self::PushTrue => "INST - PushTrue", + Self::PushFalse => "INST - PushFalse", + Self::PushUndefined => "INST - PushUndefined", + Self::PushLiteral => "INST - PushLiteral", + Self::PushEmptyObject => "INST - PushEmptyObject", + Self::PushNewArray => "INST - PushNewArray", + Self::PushValueToArray => "INST - PushValueToArray", + Self::PushElisionToArray => "INST - PushElisionToArray", + Self::PushIteratorToArray => "INST - PushIteratorToArray", + Self::Add => "INST - Add", + Self::Sub => "INST - Sub", + Self::Div => "INST - Div", + Self::Mul => "INST - Mul", + Self::Mod => "INST - Mod", + Self::Pow => "INST - Pow", + Self::ShiftRight => "INST - ShiftRight", + Self::ShiftLeft => "INST - ShiftLeft", + Self::UnsignedShiftRight => "INST - UnsignedShiftRight", + Self::BitOr => "INST - BitOr", + Self::BitAnd => "INST - BitAnd", + Self::BitXor => "INST - BitXor", + Self::BitNot => "INST - BitNot", + Self::In => "INST - In", + Self::Eq => "INST - Eq", + Self::StrictEq => "INST - StrictEq", + Self::NotEq => "INST - NotEq", + Self::StrictNotEq => "INST - StrictNotEq", + Self::GreaterThan => "INST - GreaterThan", + Self::GreaterThanOrEq => "INST - GreaterThanOrEq", + Self::LessThan => "INST - LessThan", + Self::LessThanOrEq => "INST - LessThanOrEq", + Self::InstanceOf => "INST - InstanceOf", + Self::TypeOf => "INST - TypeOf", + Self::Void => "INST - Void", + Self::LogicalNot => "INST - LogicalNot", + Self::LogicalAnd => "INST - LogicalAnd", + Self::LogicalOr => "INST - LogicalOr", + Self::Coalesce => "INST - Coalesce", + Self::Pos => "INST - Pos", + Self::Neg => "INST - Neg", + Self::Inc => "INST - Inc", + Self::IncPost => "INST - IncPost", + Self::Dec => "INST - Dec", + Self::DecPost => "INST - DecPost", + Self::DefInitArg => "INST - DefInitArg", + Self::DefVar => "INST - DefVar", + Self::DefInitVar => "INST - DefInitVar", + Self::DefLet => "INST - DefLet", + Self::DefInitLet => "INST - DefInitLet", + Self::DefInitConst => "INST - DefInitConst", + Self::GetName => "INST - GetName", + Self::GetNameOrUndefined => "INST - GetNameOrUndefined", + Self::SetName => "INST - SetName", + Self::GetPropertyByName => "INST - GetPropertyByName", + Self::GetPropertyByValue => "INST - GetPropertyByValue", + Self::SetPropertyByName => "INST - SetPropertyByName", + Self::DefineOwnPropertyByName => "INST - DefineOwnPropertyByName", + Self::SetPropertyByValue => "INST - SetPropertyByValue", + Self::DefineOwnPropertyByValue => "INST - DefineOwnPropertyByValue", + Self::SetPropertyGetterByName => "INST - SetPropertyGetterByName", + Self::SetPropertyGetterByValue => "INST - SetPropertyGetterByValue", + Self::SetPropertySetterByName => "INST - SetPropertySetterByName", + Self::SetPropertySetterByValue => "INST - SetPropertySetterByValue", + Self::DeletePropertyByName => "INST - DeletePropertyByName", + Self::DeletePropertyByValue => "INST - DeletePropertyByValue", + Self::CopyDataProperties => "INST - CopyDataProperties", + Self::Jump => "INST - Jump", + Self::JumpIfFalse => "INST - JumpIfFalse", + Self::JumpIfNotUndefined => "INST - JumpIfNotUndefined", + Self::Throw => "INST - Throw", + Self::TryStart => "INST - TryStart", + Self::TryEnd => "INST - TryEnd", + Self::CatchStart => "INST - CatchStart", + Self::CatchEnd => "INST - CatchEnd", + Self::CatchEnd2 => "INST - CatchEnd2", + Self::FinallyStart => "INST - FinallyStart", + Self::FinallyEnd => "INST - FinallyEnd", + Self::FinallySetJump => "INST - FinallySetJump", + Self::ToBoolean => "INST - ToBoolean", + Self::This => "INST - This", + Self::Case => "INST - Case", + Self::Default => "INST - Default", + Self::GetFunction => "INST - GetFunction", + Self::GetGenerator => "INST - GetGenerator", + Self::CallEval => "INST - CallEval", + Self::CallEvalWithRest => "INST - CallEvalWithRest", + Self::Call => "INST - Call", + Self::CallWithRest => "INST - CallWithRest", + Self::New => "INST - New", + Self::NewWithRest => "INST - NewWithRest", + Self::Return => "INST - Return", + Self::PushDeclarativeEnvironment => "INST - PushDeclarativeEnvironment", + Self::PushFunctionEnvironment => "INST - PushFunctionEnvironment", + Self::PopEnvironment => "INST - PopEnvironment", + Self::LoopStart => "INST - LoopStart", + Self::LoopContinue => "INST - LoopContinue", + Self::LoopEnd => "INST - LoopEnd", + Self::ForInLoopInitIterator => "INST - ForInLoopInitIterator", + Self::InitIterator => "INST - InitIterator", + Self::IteratorNext => "INST - IteratorNext", + Self::IteratorNextFull => "INST - IteratorNextFull", + Self::IteratorClose => "INST - IteratorClose", + Self::IteratorToArray => "INST - IteratorToArray", + Self::ForInLoopNext => "INST - ForInLoopNext", + Self::ConcatToString => "INST - ConcatToString", + Self::RequireObjectCoercible => "INST - RequireObjectCoercible", + Self::ValueNotNullOrUndefined => "INST - ValueNotNullOrUndefined", + Self::RestParameterInit => "INST - FunctionRestParameter", + Self::RestParameterPop => "INST - RestParameterPop", + Self::PopOnReturnAdd => "INST - PopOnReturnAdd", + Self::PopOnReturnSub => "INST - PopOnReturnSub", + Self::Yield => "INST - Yield", + Self::GeneratorNext => "INST - GeneratorNext", + Self::GeneratorNextDelegate => "INST - GeneratorNextDelegate", + Self::Nop => "INST - Nop", + Self::PushClassPrototype => "INST - PushClassPrototype", + Self::DefineClassMethodByName => "INST - DefineClassMethodByName", + Self::DefineClassMethodByValue => "INST - DefineClassMethodByValue", + Self::DefineClassGetterByName => "INST - DefineClassGetterByName", + Self::DefineClassGetterByValue => "INST - DefineClassGetterByValue", + Self::DefineClassSetterByName => "INST - DefineClassSetterByName", + Self::DefineClassSetterByValue => "INST - DefineClassSetterByValue", + Self::SetPrivateValue => "INST - SetPrivateValue", + Self::SetPrivateSetter => "INST - SetPrivateSetter", + Self::SetPrivateGetter => "INST - SetPrivateGetter", + Self::GetPrivateField => "INST - GetPrivateField", + Self::PushClassComputedFieldName => "INST - PushClassComputedFieldName", + Self::ToPropertyKey => "INST - ToPropertyKey", } } } diff --git a/boa_tester/src/main.rs b/boa_tester/src/main.rs index b4a7b69b3c8..8b33aa9062d 100644 --- a/boa_tester/src/main.rs +++ b/boa_tester/src/main.rs @@ -22,7 +22,6 @@ clippy::all, clippy::cast_lossless, clippy::redundant_closure_for_method_calls, - clippy::use_self, clippy::unnested_or_patterns, clippy::trivially_copy_pass_by_ref, clippy::needless_pass_by_value, @@ -45,6 +44,7 @@ nonstandard_style, )] #![allow( + clippy::use_self, // TODO: deny once false positives are fixed clippy::module_name_repetitions, clippy::cast_possible_truncation, clippy::cast_sign_loss,