tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

declared-subtyping.js (608B)


      1 function assertCanBeSubtype(types) {
      2  wasmValidateText(`(module
      3    ${types}
      4  )`);
      5 }
      6 
      7 function assertCannotBeSubtype(types) {
      8  assertErrorMessage(() => {
      9    assertCanBeSubtype(types);
     10  }, WebAssembly.CompileError, /incompatible super type/);
     11 }
     12 
     13 assertCanBeSubtype(`(type $a (sub (array i32))) (type $b (sub $a (array i32)))`);
     14 assertCanBeSubtype(`(type $a (sub (array (mut i32)))) (type $b (sub $a (array (mut i32))))`);
     15 assertCannotBeSubtype(`(type $a (sub (array i32))) (type $b (sub $a (array (mut i32))))`);
     16 assertCannotBeSubtype(`(type $a (sub (array (mut i32)))) (type $b (sub $a (array i32)))`);