nanvm_harness/gen.fixtures/
optional.rs1use nanvm_lib::vm::unstable::{f64_any, strict_eq, string_any, string_key};
4use nanvm_lib::vm::{Any, IStaticFunction, Nullish, Object, ToAny, ToArray, ToObject};
5
6#[rustfmt::skip]
7#[allow(clippy::if_same_then_else)]
8pub fn module<A: IStaticFunction>(runtime: Any<A>) -> Result<Any<A>, Any<A>> {
9 Ok([(string_key("default"), {
10 let _b4: Any<A> = [(string_key("a"), [(string_key("b"), f64_any(0x3ff0000000000000))].to_object().to_any()), (string_key("f"), A::static_function(|_self, _args| {
11 let _b240: Any<A> = _args.rest(0).to_any();
12 Any::dot(_b240.clone(), f64_any(0x0000000000000000)).end()
13 }, 0, [runtime.clone()].to_array(), Some("(...$0)=>$0[0]")).to_any())].to_object().to_any();
14 let _b6: Any<A> = Object::default().to_any();
15 [(Any::option_dot(_b4.clone(), || Ok(string_any("a"))).dot(|| Ok(string_any("b"))).end())?, {
16 let _b8: Any<A> = (Any::option_dot((Any::dot(_b6.clone(), string_any("a")).end())?, || Ok(string_any("b"))).end())?;
17 if Any::<A>::to_boolean(if Any::<A>::to_boolean((strict_eq(_b8.clone(), Nullish::Null.to_any()))?) { true.to_any() } else { (strict_eq(_b8.clone(), Nullish::Undefined.to_any()))? }) { f64_any(0x0000000000000000) } else { _b8.clone() }
18 }, {
19 let _b15: Any<A> = (Any::option_dot((Any::option_dot(_b6.clone(), || Ok(string_any("a"))).end())?, || Ok(string_any("b"))).end())?;
20 if Any::<A>::to_boolean(if Any::<A>::to_boolean((strict_eq(_b15.clone(), Nullish::Null.to_any()))?) { true.to_any() } else { (strict_eq(_b15.clone(), Nullish::Undefined.to_any()))? }) { f64_any(0x0000000000000000) } else { _b15.clone() }
21 }, (Any::dot(_b4.clone(), string_any("f")).option_call(&runtime, || Ok([f64_any(0x4000000000000000)].to_array().to_any())).end())?, {
22 let _b22: Any<A> = (Any::dot(_b6.clone(), string_any("f")).option_call(&runtime, || Ok([f64_any(0x4008000000000000)].to_array().to_any())).end())?;
23 if Any::<A>::to_boolean(if Any::<A>::to_boolean((strict_eq(_b22.clone(), Nullish::Null.to_any()))?) { true.to_any() } else { (strict_eq(_b22.clone(), Nullish::Undefined.to_any()))? }) { f64_any(0x0000000000000000) } else { _b22.clone() }
24 }, (Any::dot((Any::option_dot(_b4.clone(), || Ok(string_any("a"))).end())?, string_any("b")).end())?].to_array().to_any()
25 })].to_object().to_any())
26}