String Escapes and Quotes

Status: implemented, including braced Unicode escapes

Quoted strings admit JSON escapes and \u{…}. Single quotes add the escapes described below:

export default ["hello!", 'hello!'];

Between double quotes it admits JSON's escapes — \", \\, \/, \b, \f, \n, \r, \t, and \uXXXX — and no unescaped ", \ or C0 control character (U+0000 through U+001F). Between single quotes the delimiters are swapped: a " stands for itself, and \' escapes the apostrophe, so 'it\'s' and "it's" are one string. Single quotes also accept \xHH, exactly two hexadecimal digits denoting a UTF-16 code unit from U+0000 through U+00FF, and \v, denoting U+000B (vertical tab). Hexadecimal digits may use either case: '\x41' and "A" are one string, as are '\v' and "\u000b". Every other code point may stand raw in either quote, as in JSON: DEL (U+007F), the C1 controls (U+0080 through U+009F), U+FEFF, U+2028 and U+2029, and a code point above U+FFFF included. The quote is a spelling, not part of the value, and every output writes the string between double quotes.

\', \xHH and \v stay refused between double quotes, where JavaScript accepts them, while braced Unicode escapes are accepted in either quote style. JavaScript's other spellings — the \0 escape, a raw TAB or other C0 control character, a line continuation — are refused in both quotes; see js-string-literals. Backtick-delimited template literals have their own expression syntax and escape policy; \xHH and \v are admitted there.

A braced Unicode escape has one or more hexadecimal digits between braces, with a value from 0 through 0x10ffff. Leading zeros and either hex case are allowed. For example, '\u{1f600}', "\ud83d\ude00" and "😀" denote the same string. Surrogate values such as \u{d800} remain lone UTF-16 code units, as in JavaScript. Empty braces, malformed digits, missing braces and values above the limit are rejected. The spelling is also admitted in templates. JSON and DataJS retain their own string grammars.

The language designer sergey-shandar approved this increment in the working session, under DESIGN.md §12.

The NUL shorthand \0 is intentionally prohibited. Use \u0000 in any delimiter, or \x00 in single quotes and templates. Both are fixed-width and remain unambiguous when a digit follows. Literal backslash-zero text is still ordinary string data, for example \\0 inside a quoted source string.

This holds at every string position of a module: a value, an object key, plain or in brackets, the key of a property access in brackets (o['k']), the path of an import statement and the value of its attribute — with { type: 'json' } is the attribute with { type: "json" } is.

Examples

The compiler demo offers the programs stringEscapes 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 — a JSON escape, \\' in single quotes, and a \\u escape, each string's length — 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 0, 1 and 2, as JavaScript and as WebAssembly, and shows what each call returned or threw.

export default (...a) => ["tab\there", 'it\'s', "\u0041"][Number(a[0])].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 0, then 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) (String Escapes and Quotes) as a
 * function of one number, for the page's WASM demo: a JSON escape, `\\'` in
 * single quotes, and a `\\u` escape, each string's length.
 *
 * @module
 */

/** @type {(...a: readonly number[]) => unknown} */
export default (...a) => ["tab\there", 'it\'s', "\u0041"][Number(a[0])].length;

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

=>lengthbody0..objkey."length".objidx[]012"tab\there""it's""A"Numberoperand.objidxrest0

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

export default ["{}",[[":","default",["=>",0,[],[".",[".",["[]",["tab\there","it's","A"]],["Number",[".",["rest"],0]]],"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 _b264: Any<A> = _args.rest(0).to_any();
        Any::dot((Any::dot([string_any("tab\there"), string_any("it's"), string_any("A")].to_array().to_any(), (Any::number((Any::dot(_b264.clone(), f64_any(0x0000000000000000)).end())?))?).end())?, string_any("length")).end()
    }, 0, Array::default(), Some("(...$0)=>[\"tab\\there\",\"it's\",\"A\"][Number($0[0])].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::string_escapes::module::<nanvm_lib::naive::Naive> (;344;) (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 1059558
    i32.store offset=24
    local.get 2
    i32.const 1059551
    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 62
          i32.const 0
          local.get 3
          local.get 6
          i32.const 1059558
          i32.const 55
          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 $"#func339 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::string_escapes::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" (;345;) (type 4) (param i32 i32 i32 i32)
    (local i32 i32 i32 i32 i32 i32 i64)
    global.get $__stack_pointer
    i32.const 304
    i32.sub
    local.tee 4
    global.set $__stack_pointer
    local.get 4
    local.get 3
    i32.store offset=12
    local.get 4
    local.get 2
    i32.store offset=8
    local.get 2
    local.get 2
    i32.load
    i32.const 1
    i32.add
    local.tee 5
    i32.store
    block ;; label = @1
      block ;; label = @2
        block ;; label = @3
          block ;; label = @4
            block ;; label = @5
              block ;; label = @6
                local.get 5
                i32.eqz
                br_if 0 (;@6;)
                local.get 4
                local.get 3
                i32.store offset=24
                local.get 4
                local.get 2
                i32.store offset=20
                local.get 4
                i32.const 6
                i32.store8 offset=16
                local.get 4
                i32.const 0
                i32.store16 offset=144
                local.get 4
                i32.const 1059863
                i32.store offset=140
                local.get 4
                i32.const 1059855
                i32.store offset=136
                local.get 4
                i32.const 200
                i32.add
                local.get 4
                i32.const 136
                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=200
                local.tee 5
                i32.const 255
                i32.ne
                br_if 1 (;@5;)
                local.get 4
                i32.load offset=208
                local.set 5
                local.get 4
                i32.load offset=204
                local.set 6
                local.get 4
                i32.const 0
                i32.store16 offset=144
                local.get 4
                i32.const 1059867
                i32.store offset=140
                local.get 4
                i32.const 1059863
                i32.store offset=136
                local.get 4
                i32.const 200
                i32.add
                local.get 4
                i32.const 136
                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=200
                local.tee 7
                i32.const 255
                i32.ne
                br_if 2 (;@4;)
                local.get 4
                i32.load offset=208
                local.set 7
                local.get 4
                i32.load offset=204
                local.set 8
                local.get 4
                i32.const 0
                i32.store16 offset=144
                local.get 4
                i32.const 1059868
                i32.store offset=140
                local.get 4
                i32.const 1059867
                i32.store offset=136
                local.get 4
                i32.const 200
                i32.add
                local.get 4
                i32.const 136
                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=200
                local.tee 9
                i32.const 255
                i32.ne
                br_if 3 (;@3;)
                local.get 4
                i64.load offset=204 align=4
                local.set 10
                local.get 4
                i32.const 0
                i32.store8 offset=136
                local.get 4
                local.get 10
                i64.store offset=244 align=4
                local.get 4
                i32.const 3
                i32.store8 offset=240
                local.get 4
                local.get 7
                i32.store offset=232
                local.get 4
                local.get 8
                i32.store offset=228
                local.get 4
                i32.const 3
                i32.store8 offset=224
                local.get 4
                local.get 5
                i32.store offset=216
                local.get 4
                local.get 6
                i32.store offset=212
                local.get 4
                i32.const 3
                i32.store8 offset=208
                local.get 4
                i64.const 12884901888
                i64.store offset=200
                local.get 4
                local.get 4
                i32.const 136
                i32.add
                i32.store offset=256
                local.get 4
                local.get 4
                i32.const 200
                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>, 3>, 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=4
                local.tee 6
                i32.store offset=172
                local.get 4
                local.get 4
                i32.load
                local.tee 5
                i32.store offset=168
                block ;; label = @7
                  local.get 4
                  i32.load8_u offset=136
                  i32.const 1
                  i32.ne
                  br_if 0 (;@7;)
                  local.get 5
                  local.get 5
                  i32.load
                  i32.const -1
                  i32.add
                  local.tee 2
                  i32.store
                  local.get 2
                  br_if 6 (;@1;)
                  local.get 4
                  i32.const 168
                  i32.add
                  call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
                  br 6 (;@1;)
                end
                local.get 5
                i32.eqz
                br_if 5 (;@1;)
                local.get 4
                local.get 6
                i32.store offset=288
                local.get 4
                local.get 5
                i32.store offset=284
                local.get 4
                i32.const 6
                i32.store8 offset=280
                local.get 2
                local.get 2
                i32.load
                i32.const 1
                i32.add
                local.tee 5
                i32.store
                local.get 5
                i32.eqz
                br_if 0 (;@6;)
                local.get 4
                local.get 2
                i32.store offset=172
                local.get 4
                i32.const 6
                i32.store8 offset=168
                local.get 4
                local.get 3
                i64.extend_i32_u
                i64.store offset=176
                local.get 4
                i64.const 0
                i64.store offset=208
                local.get 4
                i32.const 2
                i32.store8 offset=200
                local.get 4
                i32.const 104
                i32.add
                local.get 4
                i32.const 168
                i32.add
                local.get 4
                i32.const 200
                i32.add
                call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                block ;; label = @7
                  block ;; label = @8
                    block ;; label = @9
                      block ;; label = @10
                        block ;; label = @11
                          local.get 4
                          i32.load8_u offset=104
                          i32.const 255
                          i32.ne
                          br_if 0 (;@11;)
                          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
                          local.get 4
                          i32.const 280
                          i32.add
                          call $"#func339 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                          br 1 (;@10;)
                        end
                        local.get 4
                        local.get 4
                        i64.load offset=128
                        i64.store offset=224
                        local.get 4
                        local.get 4
                        i64.load offset=120
                        i64.store offset=216
                        local.get 4
                        local.get 4
                        i64.load offset=112
                        i64.store offset=208
                        local.get 4
                        local.get 4
                        i64.load offset=104
                        i64.store offset=200
                        local.get 4
                        i32.const 168
                        i32.add
                        local.get 4
                        i32.const 200
                        i32.add
                        call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::own
                        block ;; label = @11
                          block ;; label = @12
                            local.get 4
                            i32.load8_u offset=168
                            i32.const 255
                            i32.eq
                            br_if 0 (;@12;)
                            local.get 4
                            local.get 4
                            i64.load offset=176
                            i64.store offset=64
                            local.get 4
                            local.get 4
                            i64.load offset=168
                            i64.store offset=56
                            br 1 (;@11;)
                          end
                          local.get 4
                          i32.const 256
                          i32.store16 offset=56
                        end
                        local.get 4
                        i32.const 40
                        i32.add
                        local.set 3
                        local.get 4
                        i32.const 200
                        i32.add
                        call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                        local.get 4
                        i32.const 216
                        i32.add
                        call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                        local.get 4
                        i32.const 32
                        i32.add
                        local.get 4
                        i32.const 56
                        i32.add
                        call $<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::number
                        block ;; label = @11
                          local.get 4
                          i64.load offset=32
                          i64.const 1
                          i64.ne
                          br_if 0 (;@11;)
                          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 280
                          i32.add
                          call $"#func339 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                          br 1 (;@10;)
                        end
                        local.get 4
                        local.get 3
                        i64.load offset=8
                        i64.store offset=80
                        local.get 4
                        local.get 3
                        i64.load
                        i64.store offset=72
                        local.get 4
                        i32.const 136
                        i32.add
                        local.get 4
                        i32.const 280
                        i32.add
                        local.get 4
                        i32.const 72
                        i32.add
                        call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                        local.get 4
                        i32.load8_u offset=136
                        i32.const 255
                        i32.ne
                        br_if 1 (;@9;)
                        local.get 0
                        local.get 4
                        i64.load offset=152
                        i64.store offset=16
                        local.get 0
                        local.get 4
                        i64.load offset=144
                        i64.store offset=8
                        local.get 0
                        i64.const 1
                        i64.store
                      end
                      local.get 4
                      i32.const 16
                      i32.add
                      call $"#func339 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 3
                      i32.store
                      local.get 3
                      i32.eqz
                      br_if 1 (;@8;)
                      br 2 (;@7;)
                    end
                    local.get 4
                    local.get 4
                    i64.load offset=160
                    i64.store offset=224
                    local.get 4
                    local.get 4
                    i64.load offset=152
                    i64.store offset=216
                    local.get 4
                    local.get 4
                    i64.load offset=144
                    i64.store offset=208
                    local.get 4
                    local.get 4
                    i64.load offset=136
                    i64.store offset=200
                    local.get 4
                    i32.const 168
                    i32.add
                    local.get 4
                    i32.const 200
                    i32.add
                    call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::own
                    block ;; label = @9
                      block ;; label = @10
                        local.get 4
                        i32.load8_u offset=168
                        i32.const 255
                        i32.eq
                        br_if 0 (;@10;)
                        local.get 4
                        local.get 4
                        i64.load offset=176
                        i64.store offset=96
                        local.get 4
                        local.get 4
                        i64.load offset=168
                        i64.store offset=88
                        br 1 (;@9;)
                      end
                      local.get 4
                      i32.const 256
                      i32.store16 offset=88
                    end
                    local.get 4
                    i32.const 200
                    i32.add
                    call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                    local.get 4
                    i32.const 216
                    i32.add
                    call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                    local.get 4
                    i32.const 0
                    i32.store16 offset=276
                    local.get 4
                    i32.const 1059874
                    i32.store offset=272
                    local.get 4
                    i32.const 1059868
                    i32.store offset=268
                    local.get 4
                    i32.const 200
                    i32.add
                    local.get 4
                    i32.const 268
                    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=200
                    local.tee 3
                    i32.const 255
                    i32.ne
                    br_if 6 (;@2;)
                    local.get 4
                    local.get 4
                    i64.load offset=204 align=4
                    i64.store offset=284 align=4
                    local.get 4
                    i32.const 3
                    i32.store8 offset=280
                    local.get 4
                    i32.const 168
                    i32.add
                    local.get 4
                    i32.const 88
                    i32.add
                    local.get 4
                    i32.const 280
                    i32.add
                    call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                    block ;; label = @9
                      block ;; label = @10
                        local.get 4
                        i32.load8_u offset=168
                        i32.const 255
                        i32.ne
                        br_if 0 (;@10;)
                        local.get 0
                        local.get 4
                        i64.load offset=184
                        i64.store offset=16
                        local.get 0
                        local.get 4
                        i64.load offset=176
                        i64.store offset=8
                        i64.const 1
                        local.set 10
                        br 1 (;@9;)
                      end
                      local.get 4
                      local.get 4
                      i64.load offset=192
                      i64.store offset=224
                      local.get 4
                      local.get 4
                      i64.load offset=184
                      i64.store offset=216
                      local.get 4
                      local.get 4
                      i64.load offset=176
                      i64.store offset=208
                      local.get 4
                      local.get 4
                      i64.load offset=168
                      i64.store offset=200
                      local.get 4
                      i32.const 280
                      i32.add
                      local.get 4
                      i32.const 200
                      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=280
                          i32.const 255
                          i32.eq
                          br_if 0 (;@11;)
                          local.get 0
                          i32.const 8
                          i32.add
                          local.tee 3
                          local.get 4
                          i64.load offset=288
                          i64.store offset=8
                          local.get 3
                          local.get 4
                          i64.load offset=280
                          i64.store
                          br 1 (;@10;)
                        end
                        local.get 0
                        i32.const 256
                        i32.store16 offset=8
                      end
                      local.get 4
                      i32.const 200
                      i32.add
                      call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                      local.get 4
                      i32.const 216
                      i32.add
                      call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                      i64.const 0
                      local.set 10
                    end
                    local.get 0
                    local.get 10
                    i64.store
                    local.get 4
                    i32.const 16
                    i32.add
                    call $"#func339 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 3
                    i32.store
                    local.get 3
                    br_if 1 (;@7;)
                  end
                  local.get 4
                  i32.const 8
                  i32.add
                  call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
                end
                local.get 4
                i32.const 304
                i32.add
                global.set $__stack_pointer
                return
              end
              unreachable
            end
            local.get 4
            local.get 4
            i32.load8_u offset=203
            i32.store8 offset=171
            local.get 4
            local.get 4
            i32.load16_u offset=201 align=1
            i32.store16 offset=169 align=1
            local.get 4
            local.get 4
            i32.load offset=212
            i32.store offset=180
            local.get 4
            local.get 4
            i64.load offset=204 align=4
            i64.store offset=172 align=4
            local.get 4
            local.get 5
            i32.store8 offset=168
            i32.const 1057960
            i32.const 43
            local.get 4
            i32.const 168
            i32.add
            i32.const 1057944
            i32.const 1058004
            call $core::result::unwrap_failed
            unreachable
          end
          local.get 4
          local.get 4
          i32.load8_u offset=203
          i32.store8 offset=171
          local.get 4
          local.get 4
          i32.load16_u offset=201 align=1
          i32.store16 offset=169 align=1
          local.get 4
          local.get 4
          i32.load offset=212
          i32.store offset=180
          local.get 4
          local.get 4
          i64.load offset=204 align=4
          i64.store offset=172 align=4
          local.get 4
          local.get 7
          i32.store8 offset=168
          i32.const 1057960
          i32.const 43
          local.get 4
          i32.const 168
          i32.add
          i32.const 1057944
          i32.const 1058004
          call $core::result::unwrap_failed
          unreachable
        end
        local.get 4
        local.get 4
        i32.load8_u offset=203
        i32.store8 offset=171
        local.get 4
        local.get 4
        i32.load16_u offset=201 align=1
        i32.store16 offset=169 align=1
        local.get 4
        local.get 4
        i32.load offset=212
        i32.store offset=180
        local.get 4
        local.get 4
        i64.load offset=204 align=4
        i64.store offset=172 align=4
        local.get 4
        local.get 9
        i32.store8 offset=168
        i32.const 1057960
        i32.const 43
        local.get 4
        i32.const 168
        i32.add
        i32.const 1057944
        i32.const 1058004
        call $core::result::unwrap_failed
        unreachable
      end
      local.get 4
      local.get 4
      i32.load8_u offset=203
      i32.store8 offset=171
      local.get 4
      local.get 4
      i32.load16_u offset=201 align=1
      i32.store16 offset=169 align=1
      local.get 4
      local.get 4
      i32.load offset=212
      i32.store offset=180
      local.get 4
      local.get 4
      i64.load offset=204 align=4
      i64.store offset=172 align=4
      local.get 4
      local.get 3
      i32.store8 offset=168
      i32.const 1057960
      i32.const 43
      local.get 4
      i32.const 168
      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 303
    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