You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runtime: expose DisposableStack, AsyncDisposableStack, and SuppressedError #2875
Node exposes the explicit-resource-management globals DisposableStack, AsyncDisposableStack, and SuppressedError. Perry has lowering support for using / await using declarations and well-known dispose symbols, but the standard stack constructors and SuppressedError error type are not exposed.
DisposableStack function
AsyncDisposableStack function
SuppressedError function
defer ret type undefined
x 1 disposed true
Current Perry behavior in source
crates/perry-hir/src/lower_decl/block.rs desugars using / await using declarations into try/finally blocks that call [Symbol.dispose]() / [Symbol.asyncDispose]()-style methods. The same comment notes that SuppressedError chaining is not implemented yet:
// SuppressedError chaining when a body throw is followed by a dispose throw is not yet// implemented — the dispose throw shadows the original.
Source search found no DisposableStack, AsyncDisposableStack, or SuppressedError entries in crates/perry-runtime/src/object/global_this.rs, no runtime implementations, and no constructor lowering paths. That means direct API usage such as new DisposableStack() or new SuppressedError(...) is missing even though the syntax-level using path has partial support.
Async coverage should verify AsyncDisposableStack#disposeAsync() awaits async disposers. Error-path tests should verify SuppressedError shape when both body/dispose failures occur.
Scope / non-goals
This is scoped to the standard global constructors and basic stack behavior. Existing using statement desugaring and missing well-known Symbol constants are related but separate (#2852 for remaining symbols).
Activity
fix(runtime): DisposableStack/AsyncDisposableStack/SuppressedError gl…