nanvm_demos/gen.samples/
arrays.rs1use nanvm_lib::vm::unstable::{
4 f64_any, spread_array, spread_item, string_any, string_key, value_item,
5};
6use nanvm_lib::vm::{Any, Array, IStaticFunction, Nullish, 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 Ok([(string_key("default"), A::static_function(|_self, _args| {
12 let _b524: Any<A> = _args.rest(0).to_any();
13 let _b3: Any<A> = [string_any("hello"), (Any::dot(_b524.clone(), f64_any(0x0000000000000000)).end())?, [true.to_any(), Nullish::Null.to_any()].to_array().to_any()].to_array().to_any();
14 Ok([(Any::dot(_b3.clone(), string_any("length")).end())?, (spread_array([spread_item(_b3.clone())?, value_item(((Any::dot(_b524.clone(), f64_any(0x0000000000000000)).end())? + f64_any(0x3ff0000000000000))?)]))?, (Any::dot((Any::dot(_b3.clone(), f64_any(0x4000000000000000)).end())?, f64_any(0x0000000000000000)).end())?].to_array().to_any())
15 }, 0, Array::default(), Some("(...$0)=>{const $1=[\"hello\",$0[0],[true,null]];return [$1.length,[...$1,$0[0]+1],$1[2][0]];}")).to_any())].to_object().to_any())
16}