nanvm_demos/gen.samples/
calls.rs1use nanvm_lib::vm::unstable::{
4 f64_any, spread_array, spread_item, string_any, string_key, value_item,
5};
6use nanvm_lib::vm::{Any, IStaticFunction, ToAny, ToArray, ToObject};
7
8#[rustfmt::skip]
9#[allow(clippy::if_same_then_else)]
10pub fn module<A: IStaticFunction>(runtime: Any<A>) -> Result<Any<A>, Any<A>> {
11 let _b7: Any<A> = A::static_function(|_self, _args| {
12 let _b440: Any<A> = _args.rest(0).to_any();
13 Ok(A::static_function(|_self, _args| {
14 let _b383: Any<A> = _args.rest(0).to_any();
15 (Any::dot(A::frame(_self)[0].clone(), f64_any(0x0000000000000000)).end())? + (Any::dot(_b383.clone(), f64_any(0x0000000000000000)).end())?
16 }, 0, [_b440.clone(), A::frame(_self)[0].clone()].to_array(), Some("(...$1)=>$0[0]+$1[0]")).to_any())
17 }, 0, [runtime.clone()].to_array(), Some("(...$0)=>(...$1)=>$0[0]+$1[0]")).to_any();
18 Ok([(string_key("default"), {
19 let _b12: Any<A> = [(string_key("m"), A::static_function(|_self, _args| {
20 let _b668: Any<A> = _args.rest(0).to_any();
21 spread_array([value_item((Any::dot(_b668.clone(), string_any("length")).end())?), spread_item(_b668.clone())?])
22 }, 0, [runtime.clone()].to_array(), Some("(...$0)=>[$0.length,...$0]")).to_any())].to_object().to_any();
23 A::static_function(|_self, _args| {
24 let _b1352: Any<A> = _args.rest(0).to_any();
25 Ok([{
26 let _b16: Any<A> = (Any::call(A::frame(_self)[0].clone(), [(Any::dot(_b1352.clone(), f64_any(0x0000000000000000)).end())?].to_array().to_any()))?;
27 (Any::call(_b16.clone(), [f64_any(0x4024000000000000)].to_array().to_any()))?
28 }, (Any::dot(A::frame(_self)[1].clone(), string_any("m")).end_call(&A::frame(_self)[2], || spread_array([spread_item([(Any::dot(_b1352.clone(), f64_any(0x0000000000000000)).end())?, f64_any(0x4010000000000000)].to_array().to_any())?, value_item(f64_any(0x4014000000000000))])))?].to_array().to_any())
29 }, 0, [_b7.clone(), _b12.clone(), runtime.clone()].to_array(), Some("(...$2)=>[(()=>{const $3=$0($2[0]);return $3(10);})(),$1.m(...[$2[0],4],5)]")).to_any()
30 })].to_object().to_any())
31}