nanvm_harness/gen.fixtures/
normal_if.rs1use nanvm_lib::vm::unstable::{bigint_any, f64_any, strict_eq, strict_ne, string_key};
4use nanvm_lib::vm::{Any, Array, IStaticFunction, Nullish, 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 let _b6: Any<A> = A::static_function(|_self, _args| {
10 let _b9628: Any<A> = f64_any(0x0000000000000000);
11 (if Any::<A>::to_boolean(_args.argument(0)) { (f64_any(0x0000000000000000) + f64_any(0x4000000000000000))? } else { (f64_any(0x0000000000000000) + f64_any(0x4014000000000000))? }) * f64_any(0x4024000000000000)
12 }, 1, [runtime.clone()].to_array(), Some("($0)=>{const $1=0;return ($0?0+2:0+5)*10;}")).to_any();
13 let _b12: Any<A> = A::static_function(|_self, _args| {
14 let _b9628_5: Any<A> = f64_any(0x0000000000000000);
15 (if Any::<A>::to_boolean(_args.argument(0)) { (f64_any(0x0000000000000000) + f64_any(0x4000000000000000))? } else { f64_any(0x0000000000000000) }) * f64_any(0x4024000000000000)
16 }, 1, [runtime.clone()].to_array(), Some("($0)=>{const $1=0;return ($0?0+2:0)*10;}")).to_any();
17 let _b30: Any<A> = A::static_function(|_self, _args| {
18 let _b26: Any<A> = if Any::<A>::to_boolean(_args.argument(0)) { [_args.argument(2), A::static_function(|_self, _args| { Ok(A::frame(_self)[0].clone()) }, 0, [_args.argument(2), A::frame(_self)[0].clone()].to_array(), Some("()=>$0")).to_any()].to_array().to_any() } else { [_args.argument(1), A::static_function(|_self, _args| { Ok(A::frame(_self)[0].clone()) }, 0, [_args.argument(1), A::frame(_self)[0].clone()].to_array(), Some("()=>$0")).to_any()].to_array().to_any() };
19 Ok([_b26.clone(), _b26.clone(), A::static_function(|_self, _args| { Ok(A::frame(_self)[0].clone()) }, 0, [_b26.clone(), A::frame(_self)[0].clone()].to_array(), Some("()=>$0")).to_any()].to_array().to_any())
20 }, 3, [runtime.clone()].to_array(), Some("($0,$1,$2)=>{const $3=$0?[$2,()=>$2]:[$1,()=>$1];return [$3,$3,()=>$3];}")).to_any();
21 let _b58: Any<A> = A::static_function(|_self, _args| {
22 let _b35: Any<A> = (Any::call(A::frame(_self)[0].clone(), [_args.argument(0), [f64_any(0x4008000000000000)].to_array().to_any(), [f64_any(0x401c000000000000)].to_array().to_any()].to_array().to_any()))?;
23 let _b38: Any<A> = (Any::call(A::frame(_self)[0].clone(), [_args.argument(0), [f64_any(0x4008000000000000)].to_array().to_any(), [f64_any(0x401c000000000000)].to_array().to_any()].to_array().to_any()))?;
24 Ok([(strict_eq((Any::dot(_b35.clone(), f64_any(0x0000000000000000)).end())?, (Any::dot(_b35.clone(), f64_any(0x3ff0000000000000)).end())?))?, (strict_eq((Any::dot(_b35.clone(), f64_any(0x4000000000000000)).end_call(&A::frame(_self)[1], || Ok(Array::default().to_any())))?, (Any::dot(_b35.clone(), f64_any(0x0000000000000000)).end())?))?, (strict_eq((Any::dot((Any::dot(_b35.clone(), f64_any(0x0000000000000000)).end())?, f64_any(0x3ff0000000000000)).end_call(&A::frame(_self)[1], || Ok(Array::default().to_any())))?, (Any::dot((Any::dot(_b35.clone(), f64_any(0x0000000000000000)).end())?, f64_any(0x0000000000000000)).end())?))?, (strict_ne((Any::dot(_b35.clone(), f64_any(0x0000000000000000)).end())?, (Any::dot(_b38.clone(), f64_any(0x0000000000000000)).end())?))?, (Any::dot((Any::dot((Any::dot(_b35.clone(), f64_any(0x0000000000000000)).end())?, f64_any(0x0000000000000000)).end())?, f64_any(0x0000000000000000)).end())?].to_array().to_any())
25 }, 1, [_b30.clone(), runtime.clone()].to_array(), Some("($1)=>{const $2=$0($1,[3],[7]);const $3=$0($1,[3],[7]);return [$2[0]===$2[1],$2[2]()===$2[0],$2[0][1]()===$2[0][0],$2[0]!==$3[0],$2[0][0][0]];}")).to_any();
26 let _b66: Any<A> = A::static_function(|_self, _args| {
27 let _b9628_21: Any<A> = f64_any(0x0000000000000000);
28 if Any::<A>::to_boolean(_args.argument(0)) {
29 let _b9628_22: Any<A> = (bigint_any(1) / bigint_any(0))?;
30 Ok(f64_any(0x3ff0000000000000))
31 } else { Ok(f64_any(0x0000000000000000)) }
32 }, 1, [runtime.clone()].to_array(), Some("($0)=>{const $1=0;return $0?(()=>{const $2=1n/0n;return 1;})():0;}")).to_any();
33 let _b79: Any<A> = A::static_function(|_self, _args| {
34 let _b9629: Any<A> = _args.argument(0);
35 let _b9630: Any<A> = _args.argument(1);
36 let mut _b9631: Any<A> = _b9629.clone();
37 let mut _b9632: Any<A> = _b9630.clone();
38 let mut _b9633: Any<A> = Nullish::Undefined.to_any();
39 '_loop79: loop {
40 let _b9168_31: Any<A> = _b9631.clone();
41 let _b9169_32: Any<A> = _b9632.clone();
42 if Any::<A>::to_boolean((strict_eq(_b9168_31.clone(), f64_any(0x0000000000000000)))?) {
43 let _b9634: Any<A> = _b9169_32.clone();
44 _b9633 = _b9634.clone();
45 break '_loop79;
46 } else {
47 let _b73: Any<A> = if Any::<A>::to_boolean((Any::gt(_b9168_31.clone(), f64_any(0x0000000000000000)))?) { (_b9169_32.clone() + f64_any(0x3ff0000000000000))? } else { _b9169_32.clone() };
48 let _b9635: Any<A> = (_b9168_31.clone() - f64_any(0x3ff0000000000000))?;
49 let _b9636: Any<A> = _b73.clone();
50 _b9631 = _b9635.clone();
51 _b9632 = _b9636.clone();
52 continue '_loop79;
53 }
54 }
55 let _b9187: Any<A> = _b9633.clone();
56 Ok(_b9187.clone())
57 }, 2, [runtime.clone()].to_array(), Some("($0,$1)=>{const $2=$0;const $3=$1;let $4=$2;let $5=$3;let $6=undefined;L0:while(true){const $7=$4;const $8=$5;if($7===0){const $9=$8;$6=$9;break L0;}else{const $10=$7>0?$8+1:$8;const $11=$7-1;const $12=$10;$4=$11;$5=$12;continue L0;}}const $13=$6;return $13;}")).to_any();
58 Ok([(string_key("alternate"), _b6.clone()), (string_key("default"), [(Any::call(_b12.clone(), [true.to_any()].to_array().to_any()))?, (Any::call(_b12.clone(), [false.to_any()].to_array().to_any()))?, (Any::call(_b6.clone(), [true.to_any()].to_array().to_any()))?, (Any::call(_b6.clone(), [false.to_any()].to_array().to_any()))?, (Any::call(_b58.clone(), [true.to_any()].to_array().to_any()))?, (Any::call(_b58.clone(), [false.to_any()].to_array().to_any()))?, (Any::call(_b66.clone(), [false.to_any()].to_array().to_any()))?, (Any::call(_b79.clone(), [f64_any(0x4008000000000000), f64_any(0x401c000000000000)].to_array().to_any()))?].to_array().to_any()), (string_key("normal"), _b12.clone()), (string_key("selectedFailure"), _b66.clone()), (string_key("snapshotObservation"), _b58.clone()), (string_key("tail"), _b79.clone())].to_object().to_any())
59}