Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/wasm/exnref/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  throw-ref.js

  Sprache: JAVA
 

wasmFailValidateText(`(module
  (func
    throw_ref
  )
)`, /popping value from empty stack/);

wasmValidateText(`(module
  (func (param exnref)
    local.get 0
    throw_ref
  )
)`);

// Can rethrow a value
{
  let {test} = wasmEvalText(`(module
    (tag $a)
    (func (export "test")
      (block (result exnref)
        try_table (catch_all_ref 0)
          throw $a
        end
        unreachable
      )
      throw_ref
    )
  )`).exports;

  assertErrorMessage(test, WebAssembly.Exception, /.*/);
}

// Rethrowing a value inside a try works
{
  let {test} = wasmEvalText(`(module
    (tag $E)
    (func (export "test") (param $shouldRethrow i32) (result i32)
      (local $e exnref)
      (block $catch (result exnref)
        (try_table (catch_ref $E $catch) (throw $E))
        unreachable
      )
      (local.set $e)
      (block $catch (result exnref)
        (try_table (result i32) (catch_ref $E $catch)
          (if (i32.eqz (local.get $shouldRethrow))
            (then (throw_ref (local.get $e)))
          )
          (i32.const 2)
        )
        (return)
      )
      (drop) (i32.const 1)
    )
  )`).exports;
  assertEq(test(0), 1);
  assertEq(test(1), 2);
}

// Traps on null
{
  let {test} = wasmEvalText(`(module
    (tag $a)
    (func (export "test")
      ref.null exn
      throw_ref
    )
  )`).exports;

  assertErrorMessage(test, WebAssembly.RuntimeError, /null/);
}

Messung V0.5 in Prozent
C=96 H=100 G=97

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.