native function type

This commit is contained in:
2026-02-17 17:40:44 -06:00
parent b25285f2e1
commit ad419797b4
8 changed files with 603 additions and 265 deletions

View File

@@ -827,6 +827,27 @@ run("disruption handler accesses object from outer scope", function() {
if (obj.y != 20) fail("handler mutation lost, y=" + text(obj.y))
})
run("disruption in callback with multiple calls after", function() {
// Regression: a function with a disruption handler that calls a
// callback which disrupts, followed by more successful calls.
// In native mode, cell_rt_disrupt must NOT use JS_ThrowTypeError
// (which prints to stderr) — it must silently set the exception.
var log = []
var run_inner = function(name, fn) {
fn()
log[] = "pass:" + name
} disruption {
log[] = "fail:" + name
}
run_inner("a", function() { var x = 1 })
run_inner("b", function() { disrupt })
run_inner("c", function() { var y = 2 })
if (length(log) != 3) fail("expected 3 log entries, got " + text(length(log)))
if (log[0] != "pass:a") fail("expected pass:a, got " + log[0])
if (log[1] != "fail:b") fail("expected fail:b, got " + log[1])
if (log[2] != "pass:c") fail("expected pass:c, got " + log[2])
})
// ============================================================================
// TYPE CHECKING WITH is_* FUNCTIONS
// ============================================================================