-
-
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): Fix scoping of explicit resource management pass (#…
- Loading branch information
Showing
21 changed files
with
669 additions
and
606 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
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,20 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": false, | ||
"explicitResourceManagement": true | ||
}, | ||
"target": "es2022", | ||
"loose": false, | ||
"minify": { | ||
"compress": false, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"minify": false, | ||
"isModule": true | ||
} |
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,16 @@ | ||
class File { | ||
read() { | ||
return 'content'; | ||
} | ||
[Symbol.dispose]() { | ||
console.log(`closing the file ...`); | ||
} | ||
} | ||
function main() { | ||
using file = new File(); | ||
function readFile() { | ||
file.read(); | ||
// ... | ||
} | ||
readFile(); | ||
} |
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,27 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
const _using_ctx = require("@swc/helpers/_/_using_ctx"); | ||
class File { | ||
read() { | ||
return 'content'; | ||
} | ||
[Symbol.dispose]() { | ||
console.log(`closing the file ...`); | ||
} | ||
} | ||
function main() { | ||
try { | ||
var _usingCtx = _using_ctx._(); | ||
const file = _usingCtx.u(new File()); | ||
function readFile() { | ||
file.read(); | ||
} | ||
readFile(); | ||
} catch (_) { | ||
_usingCtx.e = _; | ||
} finally{ | ||
_usingCtx.d(); | ||
} | ||
} |
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
54 changes: 27 additions & 27 deletions
54
crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=es2017).1.normal.js
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
54 changes: 27 additions & 27 deletions
54
crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=es2022).1.normal.js
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.