-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/proposal): Use
tsc
version of explicit resource management (#…
- Loading branch information
Showing
443 changed files
with
12,894 additions
and
6,704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
swc_ecma_transforms_proposal: patch | ||
swc_core: patch | ||
--- | ||
|
||
fix(es/proposal): Call `asyncDispose` correctly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
var _using_ctx = require("@swc/helpers/_/_using_ctx"); | ||
var _ts_add_disposable_resource = require("@swc/helpers/_/_ts_add_disposable_resource"); | ||
var _ts_dispose_resources = require("@swc/helpers/_/_ts_dispose_resources"); | ||
const env = { | ||
stack: [], | ||
error: void 0, | ||
hasError: false | ||
}; | ||
try { | ||
var _usingCtx = _using_ctx._(); | ||
const foo = _usingCtx.u(null); | ||
const foo = _ts_add_disposable_resource._(env, null, false); | ||
const bar = 1; | ||
console.log(baz()); | ||
function baz() { | ||
return bar; | ||
} | ||
} catch (_) { | ||
_usingCtx.e = _; | ||
} catch (e) { | ||
env.error = e; | ||
env.hasError = true; | ||
} finally{ | ||
_usingCtx.d(); | ||
_ts_dispose_resources._(env); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx"; | ||
var _Disposable; | ||
import { _ as _ts_add_disposable_resource } from "@swc/helpers/_/_ts_add_disposable_resource"; | ||
import { _ as _ts_dispose_resources } from "@swc/helpers/_/_ts_dispose_resources"; | ||
const env = { | ||
stack: [], | ||
error: void 0, | ||
hasError: false | ||
}; | ||
try { | ||
var _usingCtx = _using_ctx(); | ||
var _computedKey; | ||
_computedKey = Symbol.dispose; | ||
class Disposable { | ||
[_computedKey]() { | ||
console.log('dispose'); | ||
} | ||
} | ||
_Disposable = Disposable; | ||
var _disposable = _usingCtx.u(new Disposable()); | ||
const _disposable = _ts_add_disposable_resource(env, new Disposable(), false); | ||
console.log('ok'); | ||
} catch (_) { | ||
_usingCtx.e = _; | ||
} catch (e) { | ||
env.error = e; | ||
env.hasError = true; | ||
} finally{ | ||
_usingCtx.d(); | ||
_ts_dispose_resources(env); | ||
} | ||
export class Disposable { | ||
[_computedKey]() { | ||
console.log('dispose'); | ||
} | ||
} | ||
export { _Disposable as Disposable }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx"; | ||
var _Disposable; | ||
import { _ as _ts_add_disposable_resource } from "@swc/helpers/_/_ts_add_disposable_resource"; | ||
import { _ as _ts_dispose_resources } from "@swc/helpers/_/_ts_dispose_resources"; | ||
const env = { | ||
stack: [], | ||
error: void 0, | ||
hasError: false | ||
}; | ||
try { | ||
var _usingCtx = _using_ctx(); | ||
var Disposable = 1334; | ||
_Disposable = Disposable; | ||
var _disposable = _usingCtx.u(new Disposable()); | ||
const _disposable = _ts_add_disposable_resource(env, new Disposable(), false); | ||
console.log('ok'); | ||
} catch (_) { | ||
_usingCtx.e = _; | ||
} catch (e) { | ||
env.error = e; | ||
env.hasError = true; | ||
} finally{ | ||
_usingCtx.d(); | ||
_ts_dispose_resources(env); | ||
} | ||
export { _Disposable as Disposable }; | ||
export var Disposable = 1334; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.