Skip to content

Commit f735108

Browse files
authoredOct 17, 2024··
fix(es/proposal): Use tsc version of explicit resource management (#9585)
**Related issue:** - Closes #9576
1 parent b2d40a7 commit f735108

File tree

443 files changed

+12894
-6704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

443 files changed

+12894
-6704
lines changed
 

‎.changeset/dull-shirts-judge.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
swc_ecma_transforms_proposal: patch
3+
swc_core: patch
4+
---
5+
6+
fix(es/proposal): Call `asyncDispose` correctly
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
var _using_ctx = require("@swc/helpers/_/_using_ctx");
1+
var _ts_add_disposable_resource = require("@swc/helpers/_/_ts_add_disposable_resource");
2+
var _ts_dispose_resources = require("@swc/helpers/_/_ts_dispose_resources");
3+
const env = {
4+
stack: [],
5+
error: void 0,
6+
hasError: false
7+
};
28
try {
3-
var _usingCtx = _using_ctx._();
4-
const foo = _usingCtx.u(null);
9+
const foo = _ts_add_disposable_resource._(env, null, false);
510
const bar = 1;
611
console.log(baz());
712
function baz() {
813
return bar;
914
}
10-
} catch (_) {
11-
_usingCtx.e = _;
15+
} catch (e) {
16+
env.error = e;
17+
env.hasError = true;
1218
} finally{
13-
_usingCtx.d();
19+
_ts_dispose_resources._(env);
1420
}

0 commit comments

Comments
 (0)
Please sign in to comment.