mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
style: 自动格式化
This commit is contained in:
@@ -473,12 +473,8 @@ pub fn abstract_eq_primitives(lhs: JsValue, rhs: JsValue) -> bool {
|
||||
// Number 混合表示(int vs double):同属 ECMAScript Number,按严格相等。
|
||||
(JsType::Int | JsType::Double, JsType::Int | JsType::Double) => strict_equality(lhs, rhs),
|
||||
// BigInt 与 Number:转 f64 比较(精度内精确;超出精度近似)。
|
||||
(JsType::BigInt, JsType::Int | JsType::Double) => {
|
||||
bigint_to_f64(unsafe { bigint_data(lhs) }) == to_number(rhs)
|
||||
}
|
||||
(JsType::Int | JsType::Double, JsType::BigInt) => {
|
||||
to_number(lhs) == bigint_to_f64(unsafe { bigint_data(rhs) })
|
||||
}
|
||||
(JsType::BigInt, JsType::Int | JsType::Double) => bigint_to_f64(unsafe { bigint_data(lhs) }) == to_number(rhs),
|
||||
(JsType::Int | JsType::Double, JsType::BigInt) => to_number(lhs) == bigint_to_f64(unsafe { bigint_data(rhs) }),
|
||||
// BigInt 与 String:字符串解析为数字后比较(lossy 文本口径,见 to_number)。
|
||||
(JsType::BigInt, JsType::String) => {
|
||||
let r = parse_js_number(&unsafe { string_data(rhs) });
|
||||
@@ -536,7 +532,10 @@ pub fn abstract_eq<H: VmHost>(lhs: JsValue, rhs: JsValue, host: &mut H) -> Resul
|
||||
// Object 与原始值:ToPrimitive 后重入。to_primitive 必返原始值,
|
||||
// 重入即收敛到原始值核心,与单次委托等价。
|
||||
match (tl, tr) {
|
||||
(JsType::Object, JsType::Int | JsType::Double | JsType::String | JsType::BigInt | JsType::Symbol | JsType::Bool) => {
|
||||
(
|
||||
JsType::Object,
|
||||
JsType::Int | JsType::Double | JsType::String | JsType::BigInt | JsType::Symbol | JsType::Bool,
|
||||
) => {
|
||||
let rhs = if tr == JsType::Bool {
|
||||
// Boolean 先 ToNumber(int(0/1) 轻量编码),与原始值核心
|
||||
// 的 Boolean 重入口径一致。
|
||||
@@ -547,7 +546,10 @@ pub fn abstract_eq<H: VmHost>(lhs: JsValue, rhs: JsValue, host: &mut H) -> Resul
|
||||
let prim = to_primitive(lhs, ToPrimitiveHint::Default, host)?;
|
||||
abstract_eq(prim, rhs, host)
|
||||
}
|
||||
(JsType::Int | JsType::Double | JsType::String | JsType::BigInt | JsType::Symbol | JsType::Bool, JsType::Object) => {
|
||||
(
|
||||
JsType::Int | JsType::Double | JsType::String | JsType::BigInt | JsType::Symbol | JsType::Bool,
|
||||
JsType::Object,
|
||||
) => {
|
||||
let lhs = if tl == JsType::Bool {
|
||||
// 同上。
|
||||
JsValue::int(lhs.as_bool() as i32)
|
||||
|
||||
@@ -24,12 +24,11 @@ mod runtime_api_log;
|
||||
|
||||
pub use coercion::{
|
||||
abstract_eq, abstract_eq_primitives, bigint_data, bigint_to_f64, bigint_to_string, format_error_message,
|
||||
js_number_to_string,
|
||||
materialize_string_box, push_to_string, push_units_to, relational_compare, same_value, same_value_zero,
|
||||
strict_equality, string_concat, string_value_eq, to_bigint_full, to_boolean, to_int32, to_integer_or_infinity,
|
||||
to_length, to_number, to_number_full, to_object, to_primitive, to_string, to_string_for_string_constructor,
|
||||
to_string_full, to_string_value_full, to_uint32, to_units_full, well_known_symbol_name, write_number_into,
|
||||
ToPrimitiveHint,
|
||||
js_number_to_string, materialize_string_box, push_to_string, push_units_to, relational_compare, same_value,
|
||||
same_value_zero, strict_equality, string_concat, string_value_eq, to_bigint_full, to_boolean, to_int32,
|
||||
to_integer_or_infinity, to_length, to_number, to_number_full, to_object, to_primitive, to_string,
|
||||
to_string_for_string_constructor, to_string_full, to_string_value_full, to_uint32, to_units_full,
|
||||
well_known_symbol_name, write_number_into, ToPrimitiveHint,
|
||||
};
|
||||
pub use compiler_service::CompilerService;
|
||||
pub use event_target::{EventTargetState, ListenerEntry};
|
||||
|
||||
Reference in New Issue
Block a user