Grouping

Status: implemented

export default ([80, 443]).length;

A value may be written in parentheses, and it denotes that value: (x) is x, so the parentheses leave nothing behind — no node of their own and no change to which values a module shares — exactly as in JavaScript. A group is a value like any other and takes a property access or a call after its ), and it holds one value or the operands of a comma, (a, b), which is an operator of its own (comma) and the one that detaches a receiver.

Once admitted, parentheses leave no node behind, except for the boundary an optional chain makes of them: they end the region a ?. opened. Admission can still depend on source form, as it does for a literal bracket key (property access). They keep a property reference, so (o.m)(a) is the method call o.m(a) is (functions), and they keep sharing, so a const reached through a group is the one value it is reached without one. They launder nothing either: (1).x is the access 1 .x is, (1)(2) the call 1(2) is, and (o.toString)(1) the method call o.toString(1) is, its key judged by the call rule and not the read rule (property access): (a.push)(1) is refused at the key as a prohibited member function, as a.push(1) is, and (o.toString) alone, a read, stays refused.

What a group does change is how far an operator reaches. A group is one operand of whatever operator stands around it, so it overrides precedence and associativity as in JavaScript (operators): (1 + 2) * 3 multiplies the sum, 1 - (2 - 3) and (2 ** 3) ** 2 reverse the default association, (a ? b : c) + 1 adds to the chosen arm, and (1 + 2) ** 2 raises the sum. It bounds how far a prefix reaches too, since - binds looser than a step (unary minus): (-1).x is the access on the negation and -1 .x the negation of the access, as JavaScript reads each. A group is an operand of - as well, and the one way a function reaches the prefix at all: -((...a) => 1) is a value where -(...a) => 1 is a syntax error, there and here.

A parenthesized parameter list, (a, b) => …, is distinguished from a group and from a comma by the arrow following ). Each parameter must be a binding target; (a + b) is a group and (a, b + 1) a comma, while (a + b) => 1 and (a, b + 1) => 1 are refused.

Examples

The compiler demo offers the programs grouping in module.f.js, each with its real output.

The demo on this page runs sample.f.js, this page's example as a function of one number — parentheses that change precedence, and a group a step applies to — with every output fjs compile makes of it: the expression graph (EDAG), the Rust and the WebAssembly that Rust builds to. Its Run button calls the default export with 1 and 2, as JavaScript and as WebAssembly, and shows what each call returned or threw.

export default (...a) => [(a[0] + 2) * 3, a[0] + 2 * 3, ([80, 443]).length];

Reference

Demo

In FunctionalScript

fjs compile accepts this module, and it runs as JavaScript and as WebAssembly alike.

A FunctionalScript module and what fjs compile makes of it: the expression graph it lowers to, the Rust it compiles to on the NaNVM runtime, and the WebAssembly that Rust builds to. Run calls its default export with 1, then 2, first as the JavaScript it already is and then as WebAssembly, and shows what each call returned or threw and how long one call takes, timed over 1000 calls.

FunctionalScript source:

/**
 * The example of [`README.md`](./README.md) (Grouping) as a function of one
 * number, for the page's WASM demo: parentheses that change precedence, and
 * a group a step applies to.
 *
 * @module
 */

/** @type {(...a: readonly number[]) => unknown} */
export default (...a) => [(a[0] + 2) * 3, a[0] + 2 * 3, ([80, 443]).length];

Expression graph (EDAG) that fjs compile lowers it to:

=>lengthbody0[][]012*leftright+3+leftright.objkey[]"length"+leftright.2.objidxrest0*leftright23[]0180443.objidxrest0

The same graph, as fjs compile writes it to a .edag.data.js file:

const $0=["rest"];export default ["{}",[[":","default",["=>",0,[],["[]",[["*",["+",[".",$0,0],2],3],["+",[".",$0,0],["*",2,3]],[".",["[]",[80,443]],"length"]]]]]]];

Rust that fjs compile writes from it, on the NaNVM runtime:

// @generated by `fjs compile`. Do not edit: recompile the source module instead.

use nanvm_lib::vm::unstable::{f64_any, string_any, string_key};
use nanvm_lib::vm::{Any, Array, IStaticFunction, ToAny, ToArray, ToObject};

#[rustfmt::skip]
#[allow(clippy::if_same_then_else)]
pub fn module<A: IStaticFunction>(_runtime: Any<A>) -> Result<Any<A>, Any<A>> {
    Ok([(string_key("default"), A::static_function(|_self, _args| {
        let _b468: Any<A> = _args.rest(0).to_any();
        Ok([(((Any::dot(_b468.clone(), f64_any(0x0000000000000000)).end())? + f64_any(0x4000000000000000))? * f64_any(0x4008000000000000))?, ((Any::dot(_b468.clone(), f64_any(0x0000000000000000)).end())? + (f64_any(0x4000000000000000) * f64_any(0x4008000000000000))?)?, (Any::dot([f64_any(0x4054000000000000), f64_any(0x407bb00000000000)].to_array().to_any(), string_any("length")).end())?].to_array().to_any())
    }, 0, Array::default(), Some("(...$0)=>[($0[0]+2)*3,$0[0]+2*3,[80,443].length]")).to_any())].to_object().to_any())
}

WebAssembly text (WAT) of the functions compiled from this source, without the NaNVM runtime:

  (func $nanvm_demos::samples::grouping::module::<nanvm_lib::naive::Naive> (;705;) (type 1) (param i32 i32)
    (local i32 i32 i32 i32 i32)
    global.get $__stack_pointer
    i32.const 96
    i32.sub
    local.tee 2
    global.set $__stack_pointer
    local.get 2
    i32.const 0
    i32.store16 offset=28
    local.get 2
    i32.const 1068531
    i32.store offset=24
    local.get 2
    i32.const 1068524
    i32.store offset=20
    local.get 2
    i32.const 48
    i32.add
    local.get 2
    i32.const 20
    i32.add
    call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
    block ;; label = @1
      block ;; label = @2
        block ;; label = @3
          local.get 2
          i32.load8_u offset=48
          local.tee 3
          i32.const 255
          i32.ne
          br_if 0 (;@3;)
          local.get 2
          i32.load offset=56
          local.set 4
          local.get 2
          i32.load offset=52
          local.set 5
          local.get 2
          i32.const 0
          i32.store8 offset=32
          local.get 2
          i32.const 8
          i32.add
          local.get 2
          i32.const 32
          i32.add
          call $"<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::iter::sources::empty::Empty<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, core::result::Result<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>, ()>::Ok>, core::result::Result<core::convert::Infallible, ()>> as alloc::rc::ToRcSlice<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>::to_rc_slice"
          local.get 2
          local.get 2
          i32.load offset=12
          local.tee 6
          i32.store offset=52
          local.get 2
          local.get 2
          i32.load offset=8
          local.tee 3
          i32.store offset=48
          block ;; label = @4
            local.get 2
            i32.load8_u offset=32
            i32.const 1
            i32.ne
            br_if 0 (;@4;)
            local.get 3
            local.get 3
            i32.load
            i32.const -1
            i32.add
            local.tee 0
            i32.store
            local.get 0
            br_if 3 (;@1;)
            local.get 2
            i32.const 48
            i32.add
            call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
            br 3 (;@1;)
          end
          local.get 3
          i32.eqz
          br_if 2 (;@1;)
          i32.const 239
          i32.const 0
          local.get 3
          local.get 6
          i32.const 1068603
          i32.const 48
          call $"<nanvm_lib::naive::Naive as nanvm_lib::vm::internal::IVm>::static_function"
          local.set 3
          local.get 2
          i32.const 0
          i32.store8 offset=20
          local.get 2
          local.get 3
          i32.store offset=68
          local.get 2
          i32.const 7
          i32.store8 offset=64
          local.get 2
          local.get 4
          i32.store offset=60
          local.get 2
          local.get 5
          i32.store offset=56
          local.get 2
          i64.const 4294967296
          i64.store offset=48
          local.get 2
          local.get 2
          i32.const 20
          i32.add
          i32.store offset=80
          local.get 2
          local.get 2
          i32.const 48
          i32.add
          call $"<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::array::iter::IntoIter<(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>), 1>, core::result::Result<(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>), ()>::Ok>, core::result::Result<core::convert::Infallible, ()>> as alloc::rc::ToRcSlice<(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>)>>::to_rc_slice"
          local.get 2
          local.get 2
          i32.load offset=4
          local.tee 4
          i32.store offset=36
          local.get 2
          local.get 2
          i32.load
          local.tee 3
          i32.store offset=32
          block ;; label = @4
            local.get 2
            i32.load8_u offset=20
            i32.const 1
            i32.ne
            br_if 0 (;@4;)
            local.get 3
            local.get 3
            i32.load
            i32.const -1
            i32.add
            local.tee 0
            i32.store
            local.get 0
            br_if 2 (;@2;)
            local.get 2
            i32.const 32
            i32.add
            call $"<alloc::rc::Rc<[(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>)]>>::drop_slow"
            br 2 (;@2;)
          end
          local.get 3
          i32.eqz
          br_if 1 (;@2;)
          local.get 0
          local.get 4
          i32.store offset=16
          local.get 0
          local.get 3
          i32.store offset=12
          local.get 0
          i32.const 5
          i32.store8 offset=8
          local.get 0
          i64.const 0
          i64.store
          local.get 1
          call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
          local.get 2
          i32.const 96
          i32.add
          global.set $__stack_pointer
          return
        end
        local.get 2
        local.get 2
        i32.load8_u offset=51
        i32.store8 offset=35
        local.get 2
        local.get 2
        i32.load16_u offset=49 align=1
        i32.store16 offset=33 align=1
        local.get 2
        local.get 2
        i32.load offset=60
        i32.store offset=44
        local.get 2
        local.get 2
        i64.load offset=52 align=4
        i64.store offset=36 align=4
        local.get 2
        local.get 3
        i32.store8 offset=32
        i32.const 1057960
        i32.const 43
        local.get 2
        i32.const 32
        i32.add
        i32.const 1057944
        i32.const 1058004
        call $core::result::unwrap_failed
        unreachable
      end
      i32.const 1064316
      i32.const 43
      local.get 2
      i32.const 95
      i32.add
      i32.const 1064300
      i32.const 1064360
      call $core::result::unwrap_failed
      unreachable
    end
    i32.const 1064316
    i32.const 43
    local.get 2
    i32.const 95
    i32.add
    i32.const 1064300
    i32.const 1064360
    call $core::result::unwrap_failed
    unreachable
  )
  (func $"<nanvm_demos::samples::grouping::module<nanvm_lib::naive::Naive>::{closure#0} as core::ops::function::FnOnce<(&nanvm_lib::naive::function::Function, nanvm_lib::vm::array::Array<nanvm_lib::naive::Naive>)>>::call_once" (;706;) (type 4) (param i32 i32 i32 i32)
    (local i32 i32 i64 i32)
    global.get $__stack_pointer
    i32.const 464
    i32.sub
    local.tee 4
    global.set $__stack_pointer
    local.get 4
    local.get 3
    i32.store offset=28
    local.get 4
    local.get 2
    i32.store offset=24
    block ;; label = @1
      block ;; label = @2
        block ;; label = @3
          block ;; label = @4
            block ;; label = @5
              block ;; label = @6
                block ;; label = @7
                  block ;; label = @8
                    block ;; label = @9
                      local.get 2
                      i32.load
                      local.tee 5
                      i32.const -1
                      i32.eq
                      br_if 0 (;@9;)
                      local.get 4
                      local.get 3
                      i32.store offset=40
                      local.get 4
                      local.get 2
                      i32.store offset=36
                      local.get 4
                      i32.const 6
                      i32.store8 offset=32
                      local.get 2
                      local.get 5
                      i32.const 2
                      i32.add
                      local.tee 5
                      i32.store
                      local.get 5
                      i32.eqz
                      br_if 0 (;@9;)
                      local.get 4
                      local.get 2
                      i32.store offset=388
                      local.get 4
                      i32.const 6
                      i32.store8 offset=384
                      local.get 4
                      local.get 3
                      i64.extend_i32_u
                      i64.store offset=392
                      local.get 4
                      i64.const 0
                      i64.store offset=408
                      local.get 4
                      i32.const 2
                      i32.store8 offset=400
                      local.get 4
                      i32.const 272
                      i32.add
                      local.get 4
                      i32.const 384
                      i32.add
                      local.get 4
                      i32.const 400
                      i32.add
                      call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                      block ;; label = @10
                        local.get 4
                        i32.load8_u offset=272
                        i32.const 255
                        i32.ne
                        br_if 0 (;@10;)
                        local.get 0
                        local.get 4
                        i64.load offset=282 align=2
                        i64.store offset=10 align=2
                        local.get 0
                        local.get 4
                        i64.load offset=288 align=2
                        i64.store offset=16 align=2
                        local.get 0
                        local.get 4
                        i32.load16_u offset=280
                        i32.store16 offset=8
                        local.get 0
                        i64.const 1
                        i64.store
                        br 4 (;@6;)
                      end
                      local.get 4
                      local.get 4
                      i64.load offset=296
                      i64.store offset=424
                      local.get 4
                      local.get 4
                      i64.load offset=288
                      i64.store offset=416
                      local.get 4
                      local.get 4
                      i64.load offset=280
                      i64.store offset=408
                      local.get 4
                      local.get 4
                      i64.load offset=272
                      i64.store offset=400
                      local.get 4
                      i32.const 384
                      i32.add
                      local.get 4
                      i32.const 400
                      i32.add
                      call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::own
                      block ;; label = @10
                        block ;; label = @11
                          local.get 4
                          i32.load8_u offset=384
                          local.tee 3
                          i32.const 255
                          i32.ne
                          br_if 0 (;@11;)
                          i32.const 1
                          local.set 5
                          i32.const 0
                          local.set 3
                          br 1 (;@10;)
                        end
                        local.get 4
                        local.get 4
                        i64.load offset=386 align=2
                        i64.store offset=256
                        local.get 4
                        local.get 4
                        i64.load offset=392 align=2
                        i64.store offset=262 align=2
                        local.get 4
                        i32.load8_u offset=385
                        local.set 5
                      end
                      local.get 4
                      i32.const 400
                      i32.add
                      call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                      local.get 4
                      i32.const 416
                      i32.add
                      call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                      local.get 4
                      local.get 4
                      i64.load offset=262 align=2
                      i64.store offset=152 align=2
                      local.get 4
                      local.get 4
                      i64.load offset=256
                      i64.store offset=146 align=2
                      local.get 4
                      local.get 5
                      i32.store8 offset=145
                      local.get 4
                      local.get 3
                      i32.store8 offset=144
                      local.get 4
                      i64.const 4611686018427387904
                      i64.store offset=408
                      local.get 4
                      i32.const 2
                      i32.store8 offset=400
                      local.get 4
                      i32.const 352
                      i32.add
                      local.get 4
                      i32.const 144
                      i32.add
                      local.get 4
                      i32.const 400
                      i32.add
                      call $"<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive> as core::ops::arith::Add>::add"
                      local.get 4
                      local.get 4
                      i64.load offset=360
                      i64.store offset=128
                      local.get 4
                      local.get 4
                      i64.load offset=368
                      i64.store offset=136
                      block ;; label = @10
                        local.get 4
                        i64.load offset=352
                        i64.const 1
                        i64.ne
                        br_if 0 (;@10;)
                        local.get 0
                        local.get 4
                        i64.load offset=136
                        i64.store offset=16
                        local.get 0
                        local.get 4
                        i64.load offset=128
                        i64.store offset=8
                        local.get 0
                        i64.const 1
                        i64.store
                        br 4 (;@6;)
                      end
                      local.get 4
                      local.get 4
                      i64.load offset=136
                      i64.store offset=168
                      local.get 4
                      local.get 4
                      i64.load offset=128
                      i64.store offset=160
                      local.get 4
                      i64.const 4613937818241073152
                      i64.store offset=408
                      local.get 4
                      i32.const 2
                      i32.store8 offset=400
                      local.get 4
                      i32.const 304
                      i32.add
                      local.get 4
                      i32.const 160
                      i32.add
                      local.get 4
                      i32.const 400
                      i32.add
                      call $"<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::numeric_op::<<nanvm_lib::vm::numeric::Numeric<nanvm_lib::naive::Naive> as core::ops::arith::Mul>::mul>"
                      local.get 4
                      local.get 4
                      i64.load offset=312
                      i64.store offset=112
                      local.get 4
                      local.get 4
                      i64.load offset=320
                      i64.store offset=120
                      block ;; label = @10
                        local.get 4
                        i64.load offset=304
                        i64.const 1
                        i64.ne
                        br_if 0 (;@10;)
                        local.get 0
                        local.get 4
                        i64.load offset=120
                        i64.store offset=16
                        local.get 0
                        local.get 4
                        i64.load offset=112
                        i64.store offset=8
                        local.get 0
                        i64.const 1
                        i64.store
                        br 4 (;@6;)
                      end
                      local.get 4
                      local.get 4
                      i64.load offset=120
                      i64.store offset=104
                      local.get 4
                      local.get 4
                      i64.load offset=112
                      i64.store offset=96
                      block ;; label = @10
                        block ;; label = @11
                          block ;; label = @12
                            block ;; label = @13
                              block ;; label = @14
                                block ;; label = @15
                                  block ;; label = @16
                                    block ;; label = @17
                                      local.get 4
                                      i32.load8_u offset=32
                                      local.tee 5
                                      br_table 6 (;@11;) 6 (;@11;) 0 (;@17;) 1 (;@16;) 2 (;@15;) 3 (;@14;) 4 (;@13;) 5 (;@12;) 6 (;@11;)
                                    end
                                    local.get 4
                                    i64.load offset=40
                                    local.set 6
                                    br 9 (;@7;)
                                  end
                                  local.get 4
                                  i32.load offset=36
                                  local.tee 3
                                  local.get 3
                                  i32.load
                                  i32.const 1
                                  i32.add
                                  local.tee 7
                                  i32.store
                                  local.get 7
                                  i32.eqz
                                  br_if 6 (;@9;)
                                  br 7 (;@8;)
                                end
                                local.get 4
                                i32.load offset=36
                                local.tee 3
                                local.get 3
                                i32.load
                                i32.const 1
                                i32.add
                                local.tee 7
                                i32.store
                                local.get 7
                                i32.eqz
                                br_if 5 (;@9;)
                                local.get 4
                                i64.load8_u offset=44
                                i64.const 32
                                i64.shl
                                local.get 4
                                i64.load32_u offset=40
                                i64.or
                                local.set 6
                                br 7 (;@7;)
                              end
                              local.get 4
                              i32.load offset=36
                              local.tee 3
                              local.get 3
                              i32.load
                              i32.const 1
                              i32.add
                              local.tee 7
                              i32.store
                              local.get 7
                              br_if 5 (;@8;)
                              br 4 (;@9;)
                            end
                            local.get 4
                            i32.load offset=36
                            local.tee 3
                            local.get 3
                            i32.load
                            i32.const 1
                            i32.add
                            local.tee 7
                            i32.store
                            local.get 7
                            br_if 4 (;@8;)
                            br 3 (;@9;)
                          end
                          local.get 4
                          i32.load offset=36
                          local.tee 3
                          local.get 3
                          i32.load
                          i32.const 1
                          i32.add
                          local.tee 7
                          i32.store
                          local.get 7
                          i32.eqz
                          br_if 2 (;@9;)
                          br 1 (;@10;)
                        end
                        local.get 4
                        i32.load8_u offset=33
                        local.set 7
                      end
                      br 2 (;@7;)
                    end
                    unreachable
                  end
                  local.get 4
                  i64.load32_u offset=40
                  local.set 6
                end
                local.get 4
                local.get 6
                i64.store offset=360
                local.get 4
                local.get 3
                i32.store offset=356
                local.get 4
                local.get 7
                i32.store8 offset=353
                local.get 4
                local.get 5
                i32.store8 offset=352
                local.get 4
                i64.const 0
                i64.store offset=408
                local.get 4
                i32.const 2
                i32.store8 offset=400
                local.get 4
                i32.const 304
                i32.add
                local.get 4
                i32.const 352
                i32.add
                local.get 4
                i32.const 400
                i32.add
                call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                block ;; label = @7
                  block ;; label = @8
                    local.get 4
                    i32.load8_u offset=304
                    i32.const 255
                    i32.ne
                    br_if 0 (;@8;)
                    local.get 0
                    local.get 4
                    i64.load offset=314 align=2
                    i64.store offset=10 align=2
                    local.get 0
                    local.get 4
                    i64.load offset=320 align=2
                    i64.store offset=16 align=2
                    local.get 0
                    local.get 4
                    i32.load16_u offset=312
                    i32.store16 offset=8
                    local.get 0
                    i64.const 1
                    i64.store
                    br 1 (;@7;)
                  end
                  local.get 4
                  local.get 4
                  i64.load offset=328
                  i64.store offset=424
                  local.get 4
                  local.get 4
                  i64.load offset=320
                  i64.store offset=416
                  local.get 4
                  local.get 4
                  i64.load offset=312
                  i64.store offset=408
                  local.get 4
                  local.get 4
                  i64.load offset=304
                  i64.store offset=400
                  local.get 4
                  i32.const 352
                  i32.add
                  local.get 4
                  i32.const 400
                  i32.add
                  call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::own
                  block ;; label = @8
                    block ;; label = @9
                      local.get 4
                      i32.load8_u offset=352
                      local.tee 5
                      i32.const 255
                      i32.ne
                      br_if 0 (;@9;)
                      i32.const 1
                      local.set 7
                      i32.const 0
                      local.set 5
                      br 1 (;@8;)
                    end
                    local.get 4
                    local.get 4
                    i64.load offset=354 align=2
                    i64.store offset=336
                    local.get 4
                    local.get 4
                    i64.load offset=360 align=2
                    i64.store offset=342 align=2
                    local.get 4
                    i32.load8_u offset=353
                    local.set 7
                  end
                  local.get 4
                  i32.const 216
                  i32.add
                  i32.const 8
                  i32.add
                  local.set 3
                  local.get 4
                  i32.const 400
                  i32.add
                  call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                  local.get 4
                  i32.const 416
                  i32.add
                  call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                  local.get 4
                  local.get 7
                  i32.store8 offset=385
                  local.get 4
                  local.get 5
                  i32.store8 offset=384
                  local.get 4
                  local.get 4
                  i64.load offset=336
                  i64.store offset=386 align=2
                  local.get 4
                  local.get 4
                  i64.load offset=342 align=2
                  i64.store offset=392 align=2
                  local.get 4
                  i64.const 4611686018427387904
                  i64.store offset=360
                  local.get 4
                  i32.const 2
                  i32.store8 offset=352
                  local.get 4
                  i64.const 4613937818241073152
                  i64.store offset=408
                  local.get 4
                  i32.const 2
                  i32.store8 offset=400
                  local.get 4
                  i32.const 216
                  i32.add
                  local.get 4
                  i32.const 352
                  i32.add
                  local.get 4
                  i32.const 400
                  i32.add
                  call $"<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::numeric_op::<<nanvm_lib::vm::numeric::Numeric<nanvm_lib::naive::Naive> as core::ops::arith::Mul>::mul>"
                  block ;; label = @8
                    local.get 4
                    i64.load offset=216
                    i64.const 1
                    i64.ne
                    br_if 0 (;@8;)
                    local.get 0
                    i64.const 1
                    i64.store
                    local.get 0
                    local.get 3
                    i64.load offset=8
                    i64.store offset=16
                    local.get 0
                    local.get 3
                    i64.load
                    i64.store offset=8
                    local.get 4
                    i32.const 384
                    i32.add
                    call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                    br 1 (;@7;)
                  end
                  local.get 4
                  i32.const 192
                  i32.add
                  i32.const 8
                  i32.add
                  local.set 5
                  local.get 4
                  local.get 3
                  i64.load offset=8
                  i64.store offset=248
                  local.get 4
                  local.get 3
                  i64.load
                  i64.store offset=240
                  local.get 4
                  i32.const 192
                  i32.add
                  local.get 4
                  i32.const 384
                  i32.add
                  local.get 4
                  i32.const 240
                  i32.add
                  call $"<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive> as core::ops::arith::Add>::add"
                  block ;; label = @8
                    local.get 4
                    i64.load offset=192
                    i64.const 1
                    i64.ne
                    br_if 0 (;@8;)
                    local.get 0
                    i64.const 1
                    i64.store
                    local.get 0
                    local.get 5
                    i64.load offset=8
                    i64.store offset=16
                    local.get 0
                    local.get 5
                    i64.load
                    i64.store offset=8
                    br 1 (;@7;)
                  end
                  local.get 4
                  local.get 5
                  i64.load offset=8
                  i64.store offset=184
                  local.get 4
                  local.get 5
                  i64.load
                  i64.store offset=176
                  local.get 4
                  i32.const 0
                  i32.store8 offset=384
                  local.get 4
                  i64.const 4646500954609287168
                  i64.store offset=432
                  local.get 4
                  i32.const 2
                  i32.store8 offset=424
                  local.get 4
                  i64.const 4635329916471083008
                  i64.store offset=416
                  local.get 4
                  i32.const 2
                  i32.store8 offset=408
                  local.get 4
                  i64.const 8589934592
                  i64.store offset=400
                  local.get 4
                  local.get 4
                  i32.const 384
                  i32.add
                  i32.store offset=440
                  local.get 4
                  i32.const 16
                  i32.add
                  local.get 4
                  i32.const 400
                  i32.add
                  call $"<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::array::iter::IntoIter<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>, 2>, core::result::Result<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>, ()>::Ok>, core::result::Result<core::convert::Infallible, ()>> as alloc::rc::ToRcSlice<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>::to_rc_slice"
                  local.get 4
                  local.get 4
                  i32.load offset=20
                  local.tee 7
                  i32.store offset=356
                  local.get 4
                  local.get 4
                  i32.load offset=16
                  local.tee 3
                  i32.store offset=352
                  block ;; label = @8
                    local.get 4
                    i32.load8_u offset=384
                    i32.const 1
                    i32.ne
                    br_if 0 (;@8;)
                    local.get 3
                    local.get 3
                    i32.load
                    i32.const -1
                    i32.add
                    local.tee 2
                    i32.store
                    local.get 2
                    br_if 7 (;@1;)
                    local.get 4
                    i32.const 352
                    i32.add
                    call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
                    br 7 (;@1;)
                  end
                  local.get 3
                  i32.eqz
                  br_if 6 (;@1;)
                  local.get 4
                  local.get 7
                  i32.store offset=264
                  local.get 4
                  local.get 3
                  i32.store offset=260
                  local.get 4
                  i32.const 6
                  i32.store8 offset=256
                  local.get 4
                  i32.const 0
                  i32.store16 offset=456
                  local.get 4
                  i32.const 1068838
                  i32.store offset=452
                  local.get 4
                  i32.const 1068832
                  i32.store offset=448
                  local.get 4
                  i32.const 400
                  i32.add
                  local.get 4
                  i32.const 448
                  i32.add
                  call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                  local.get 4
                  i32.load8_u offset=400
                  local.tee 3
                  i32.const 255
                  i32.ne
                  br_if 5 (;@2;)
                  local.get 4
                  local.get 4
                  i64.load offset=404 align=4
                  i64.store offset=388 align=4
                  local.get 4
                  i32.const 3
                  i32.store8 offset=384
                  local.get 4
                  i32.const 352
                  i32.add
                  local.get 4
                  i32.const 256
                  i32.add
                  local.get 4
                  i32.const 384
                  i32.add
                  call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                  local.get 4
                  i32.load8_u offset=352
                  i32.const 255
                  i32.ne
                  br_if 2 (;@5;)
                  local.get 0
                  local.get 4
                  i64.load offset=368
                  i64.store offset=16
                  local.get 0
                  local.get 4
                  i64.load offset=360
                  i64.store offset=8
                  local.get 0
                  i64.const 1
                  i64.store
                  local.get 4
                  i32.const 176
                  i32.add
                  call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                end
                local.get 4
                i32.const 96
                i32.add
                call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
              end
              local.get 4
              i32.const 32
              i32.add
              call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
              local.get 2
              local.get 2
              i32.load
              i32.const -1
              i32.add
              local.tee 0
              i32.store
              local.get 0
              i32.eqz
              br_if 1 (;@4;)
              br 2 (;@3;)
            end
            local.get 4
            local.get 4
            i64.load offset=376
            i64.store offset=424
            local.get 4
            local.get 4
            i64.load offset=368
            i64.store offset=416
            local.get 4
            local.get 4
            i64.load offset=360
            i64.store offset=408
            local.get 4
            local.get 4
            i64.load offset=352
            i64.store offset=400
            local.get 4
            i32.const 80
            i32.add
            local.get 4
            i32.const 400
            i32.add
            call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::read
            local.get 4
            local.get 4
            i64.load offset=96
            i64.store offset=48
            local.get 4
            local.get 4
            i64.load offset=104
            i64.store offset=56
            local.get 4
            local.get 5
            i64.load
            i64.store offset=64
            local.get 4
            local.get 5
            i64.load offset=8
            i64.store offset=72
            local.get 4
            i32.const 8
            i32.add
            local.get 4
            i32.const 48
            i32.add
            call $"<nanvm_lib::naive::container::Container<(), nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as nanvm_lib::vm::internal::icontainer::IContainer<nanvm_lib::naive::Naive>>::new_ok::<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>; 3]>"
            local.get 0
            local.get 4
            i64.load offset=8
            i64.store offset=12 align=4
            local.get 0
            i32.const 6
            i32.store8 offset=8
            local.get 0
            i64.const 0
            i64.store
            local.get 4
            i32.const 32
            i32.add
            call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
            local.get 2
            local.get 2
            i32.load
            i32.const -1
            i32.add
            local.tee 0
            i32.store
            local.get 0
            br_if 1 (;@3;)
          end
          local.get 4
          i32.const 24
          i32.add
          call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
        end
        local.get 4
        i32.const 464
        i32.add
        global.set $__stack_pointer
        return
      end
      local.get 4
      local.get 4
      i32.load8_u offset=403
      i32.store8 offset=355
      local.get 4
      local.get 4
      i32.load16_u offset=401 align=1
      i32.store16 offset=353 align=1
      local.get 4
      local.get 4
      i32.load offset=412
      i32.store offset=364
      local.get 4
      local.get 4
      i64.load offset=404 align=4
      i64.store offset=356 align=4
      local.get 4
      local.get 3
      i32.store8 offset=352
      i32.const 1057960
      i32.const 43
      local.get 4
      i32.const 352
      i32.add
      i32.const 1057944
      i32.const 1058004
      call $core::result::unwrap_failed
      unreachable
    end
    i32.const 1064316
    i32.const 43
    local.get 4
    i32.const 463
    i32.add
    i32.const 1064300
    i32.const 1064360
    call $core::result::unwrap_failed
    unreachable
  )

Emergent Testing

Idle. Press Run to start the suite.

  • ./proof.f.mjs