From b7489e77adfe4a4ee13cd0461045f20cb8614d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 19 Sep 2023 15:09:35 +0200 Subject: [PATCH] Improve source maps for blocks with `using` declarations (#15985) --- .../src/index.ts | 4 +- .../test/fixtures/source-maps/block/input.js | 4 + .../test/fixtures/source-maps/block/output.js | 10 ++ .../source-maps/block/source-map-visual.txt | 137 ++++++++++++++++ .../source-maps/block/source-map.json | 22 +++ .../test/fixtures/source-maps/for-of/input.js | 3 + .../fixtures/source-maps/for-of/output.js | 10 ++ .../source-maps/for-of/source-map-visual.txt | 149 ++++++++++++++++++ .../source-maps/for-of/source-map.json | 23 +++ .../test/fixtures/source-maps/options.json | 4 + .../fixtures/source-maps/top-level/input.mjs | 4 + .../fixtures/source-maps/top-level/output.mjs | 12 ++ .../top-level/source-map-visual.txt | 134 ++++++++++++++++ .../source-maps/top-level/source-map.json | 24 +++ 14 files changed, 539 insertions(+), 1 deletion(-) create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/input.js create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/output.js create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map-visual.txt create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map.json create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/input.js create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/output.js create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map-visual.txt create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map.json create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/options.json create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/input.mjs create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/output.mjs create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map-visual.txt create mode 100644 packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map.json diff --git a/packages/babel-plugin-proposal-explicit-resource-management/src/index.ts b/packages/babel-plugin-proposal-explicit-resource-management/src/index.ts index c23f58505ea4..2791a328f42b 100644 --- a/packages/babel-plugin-proposal-explicit-resource-management/src/index.ts +++ b/packages/babel-plugin-proposal-explicit-resource-management/src/index.ts @@ -84,7 +84,9 @@ export default declare(api => { } finally { ${disposeCall} } - `; + ` as t.TryStatement; + + t.inherits(replacement.block, path.node); const { parentPath } = path; if ( diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/input.js b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/input.js new file mode 100644 index 000000000000..5bb5632a9d34 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/input.js @@ -0,0 +1,4 @@ +{ + using x = fn(); + doSomethingWith(x); +} diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/output.js b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/output.js new file mode 100644 index 000000000000..e21f27aee235 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/output.js @@ -0,0 +1,10 @@ +try { + var _stack = []; + const x = babelHelpers.using(_stack, fn()); + doSomethingWith(x); +} catch (_) { + var _error = _; + var _hasError = true; +} finally { + babelHelpers.dispose(_stack, _error, _hasError); +} diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map-visual.txt b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map-visual.txt new file mode 100644 index 000000000000..f255e9b4f855 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map-visual.txt @@ -0,0 +1,137 @@ + (1:0-1) { <-- (1:4-5) try { + ^ ^ + + (1:0-1) { <-- (2:2-6) var _sta + ^ ^^^^ + + (1:0-1) { <-- (2:6-12) var _stack = [ + ^ ^^^^^^ + + (1:0-1) { <-- (2:12-18) tack = []; + ^ ^^^^^^ + + (2:2-8) using x = <-- (3:2-8) const x = + ^^^^^^ ^^^^^^ + + (2:8-9) ing x = f <-- (3:8-9) nst x = b + ^ ^ + + (2:9-12) ng x = fn() <-- (3:9-12) st x = babe + ^^^ ^^^ + + (2:9-12) ng x = fn() <-- (3:12-24) x = babelHelpers.usi + ^^^ ^^^^^^^^^^^^ + + (2:9-12) ng x = fn() <-- (3:24-25) pers.usin + ^^^ ^ + + (2:9-12) ng x = fn() <-- (3:25-30) ers.using(_st + ^^^ ^^^^^ + + (2:9-12) ng x = fn() <-- (3:30-31) sing(_sta + ^^^ ^ + + (2:9-12) ng x = fn() <-- (3:31-37) ing(_stack, fn + ^^^ ^^^^^^ + + (2:9-12) ng x = fn() <-- (3:37-39) tack, fn() + ^^^ ^^ + +(2:12-14) x = fn(); <-- (3:39-41) ck, fn()); + ^^ ^^ + +(2:14-15) = fn(); <-- (3:41-42) , fn()); + ^ ^ + +(2:15-16) fn(); <-- (3:42-43) fn()); + ^ ^ + +(2:16-17) fn(); <-- (3:43-45) fn()); + ^ ^^ + + (3:2-17) doSomethingWith(x); <-- (4:2-17) doSomethingWith(x); + ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ + +(3:17-18) With(x); <-- (4:17-18) With(x); + ^ ^ + +(3:18-19) ith(x); <-- (4:18-19) ith(x); + ^ ^ + +(3:19-20) th(x); <-- (4:19-20) th(x); + ^ ^ + +(3:20-21) h(x); <-- (4:20-21) h(x); + ^ ^ + + (4:0-1) } <-- (5:0-1) } cat + ^ ^ + + (4:1-1) } <-- (5:1-9) } catch (_) { + >< ^^^^^^^^ + + (4:1-1) } <-- (5:9-10) ch (_) { + >< ^ + + (4:1-1) } <-- (5:10-13) h (_) { + >< ^^^ + + (4:1-1) } <-- (6:2-6) var _err + >< ^^^^ + + (4:1-1) } <-- (6:6-12) var _error = _ + >< ^^^^^^ + + (4:1-1) } <-- (6:12-15) rror = _; + >< ^^^ + + (4:1-1) } <-- (6:15-16) r = _; + >< ^ + + (4:1-1) } <-- (6:16-17) = _; + >< ^ + + (4:1-1) } <-- (7:2-6) var _has + >< ^^^^ + + (4:1-1) } <-- (7:6-15) var _hasError = t + >< ^^^^^^^^^ + + (4:1-1) } <-- (7:15-23) rror = true; + >< ^^^^^^^^ + + (4:1-1) } <-- (8:0-11) } finally { + >< ^^^^^^^^^^^ + + (4:1-1) } <-- (9:2-14) babelHelpers.dis + >< ^^^^^^^^^^^^ + + (4:1-1) } <-- (9:14-15) pers.disp + >< ^ + + (4:1-1) } <-- (9:15-22) ers.dispose(_st + >< ^^^^^^^ + + (4:1-1) } <-- (9:22-23) pose(_sta + >< ^ + + (4:1-1) } <-- (9:23-29) ose(_stack, _e + >< ^^^^^^ + + (4:1-1) } <-- (9:29-31) tack, _err + >< ^^ + + (4:1-1) } <-- (9:31-37) ck, _error, _h + >< ^^^^^^ + + (4:1-1) } <-- (9:37-39) rror, _has + >< ^^ + + (4:1-1) } <-- (9:39-48) or, _hasError); + >< ^^^^^^^^^ + + (4:1-1) } <-- (9:48-50) rror); + >< ^^ + + (4:1-1) } <-- (10:0-1) } + >< ^ diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map.json b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map.json new file mode 100644 index 000000000000..a058dbef940e --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/block/source-map.json @@ -0,0 +1,22 @@ +{ + "version": 3, + "names": [ + "_stack", + "x", + "babelHelpers", + "using", + "fn", + "doSomethingWith", + "_", + "_error", + "_hasError", + "dispose" + ], + "sources": [ + "source-maps/block/input.js" + ], + "sourcesContent": [ + "{\n using x = fn();\n doSomethingWith(x);\n}" + ], + "mappings": "IAAA;EAAA,IAAAA,MAAA;EACE,MAAMC,CAAC,GAAAC,YAAA,CAAAC,KAAA,CAAAH,MAAA,EAAGI,EAAE,CAAC,CAAC;EACdC,eAAe,CAACJ,CAAC,CAAC;AACpB,CAAC,QAAAK,CAAA;EAAA,IAAAC,MAAA,GAAAD,CAAA;EAAA,IAAAE,SAAA;AAAA;EAAAN,YAAA,CAAAO,OAAA,CAAAT,MAAA,EAAAO,MAAA,EAAAC,SAAA;AAAA" +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/input.js b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/input.js new file mode 100644 index 000000000000..24343c97f1df --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/input.js @@ -0,0 +1,3 @@ +for (using x of it) { + doSomethingWith(x); +} diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/output.js b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/output.js new file mode 100644 index 000000000000..f892a2cc1713 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/output.js @@ -0,0 +1,10 @@ +for (const _x of it) try { + var _stack = []; + const x = babelHelpers.using(_stack, _x); + doSomethingWith(x); +} catch (_) { + var _error = _; + var _hasError = true; +} finally { + babelHelpers.dispose(_stack, _error, _hasError); +} diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map-visual.txt b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map-visual.txt new file mode 100644 index 000000000000..911e65e01785 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map-visual.txt @@ -0,0 +1,149 @@ + (1:0-5) for (usin <-- (1:0-5) for (cons + ^^^^^ ^^^^^ + + (1:5-11) or (using x of <-- (1:5-11) or (const _x o + ^^^^^^ ^^^^^^ + +(1:11-12) ing x of <-- (1:11-13) nst _x of + ^ ^^ + +(1:12-16) ng x of it) <-- (1:13-17) t _x of it) + ^^^^ ^^^^ + +(1:16-18) of it) { <-- (1:17-19) of it) tr + ^^ ^^ + +(1:18-20) f it) { <-- (1:19-25) f it) try { + ^^ ^^^^^^ + +(1:20-20) it) { <-- (1:25-26) try { + >< ^ + +(1:20-20) it) { <-- (2:2-6) var _sta + >< ^^^^ + +(1:20-20) it) { <-- (2:6-12) var _stack = [ + >< ^^^^^^ + +(1:20-20) it) { <-- (2:12-18) tack = []; + >< ^^^^^^ + +(1:20-20) it) { <-- (3:2-8) const x = + >< ^^^^^^ + +(1:11-12) ing x of <-- (3:8-9) nst x = b + ^ ^ + +(1:12-21) ng x of it) { <-- (3:9-12) st x = babe + ^^^^^^^^^ ^^^ + +(1:12-21) ng x of it) { <-- (3:12-24) x = babelHelpers.usi + ^^^^^^^^^ ^^^^^^^^^^^^ + +(1:12-21) ng x of it) { <-- (3:24-25) pers.usin + ^^^^^^^^^ ^ + +(1:12-21) ng x of it) { <-- (3:25-30) ers.using(_st + ^^^^^^^^^ ^^^^^ + +(1:12-21) ng x of it) { <-- (3:30-31) sing(_sta + ^^^^^^^^^ ^ + +(1:12-21) ng x of it) { <-- (3:31-37) ing(_stack, _x + ^^^^^^^^^ ^^^^^^ + +(1:12-21) ng x of it) { <-- (3:37-39) tack, _x); + ^^^^^^^^^ ^^ + +(1:12-21) ng x of it) { <-- (3:39-41) ck, _x); + ^^^^^^^^^ ^^ + +(1:12-21) ng x of it) { <-- (3:41-43) , _x); + ^^^^^^^^^ ^^ + + (2:2-17) doSomethingWith(x); <-- (4:2-17) doSomethingWith(x); + ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ + +(2:17-18) With(x); <-- (4:17-18) With(x); + ^ ^ + +(2:18-19) ith(x); <-- (4:18-19) ith(x); + ^ ^ + +(2:19-20) th(x); <-- (4:19-20) th(x); + ^ ^ + +(2:20-21) h(x); <-- (4:20-21) h(x); + ^ ^ + + (3:0-1) } <-- (5:0-1) } cat + ^ ^ + + (3:1-1) } <-- (5:1-9) } catch (_) { + >< ^^^^^^^^ + + (3:1-1) } <-- (5:9-10) ch (_) { + >< ^ + + (3:1-1) } <-- (5:10-13) h (_) { + >< ^^^ + + (3:1-1) } <-- (6:2-6) var _err + >< ^^^^ + + (3:1-1) } <-- (6:6-12) var _error = _ + >< ^^^^^^ + + (3:1-1) } <-- (6:12-15) rror = _; + >< ^^^ + + (3:1-1) } <-- (6:15-16) r = _; + >< ^ + + (3:1-1) } <-- (6:16-17) = _; + >< ^ + + (3:1-1) } <-- (7:2-6) var _has + >< ^^^^ + + (3:1-1) } <-- (7:6-15) var _hasError = t + >< ^^^^^^^^^ + + (3:1-1) } <-- (7:15-23) rror = true; + >< ^^^^^^^^ + + (3:1-1) } <-- (8:0-11) } finally { + >< ^^^^^^^^^^^ + + (3:1-1) } <-- (9:2-14) babelHelpers.dis + >< ^^^^^^^^^^^^ + + (3:1-1) } <-- (9:14-15) pers.disp + >< ^ + + (3:1-1) } <-- (9:15-22) ers.dispose(_st + >< ^^^^^^^ + + (3:1-1) } <-- (9:22-23) pose(_sta + >< ^ + + (3:1-1) } <-- (9:23-29) ose(_stack, _e + >< ^^^^^^ + + (3:1-1) } <-- (9:29-31) tack, _err + >< ^^ + + (3:1-1) } <-- (9:31-37) ck, _error, _h + >< ^^^^^^ + + (3:1-1) } <-- (9:37-39) rror, _has + >< ^^ + + (3:1-1) } <-- (9:39-48) or, _hasError); + >< ^^^^^^^^^ + + (3:1-1) } <-- (9:48-50) rror); + >< ^^ + + (3:1-1) } <-- (10:0-1) } + >< ^ diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map.json b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map.json new file mode 100644 index 000000000000..5e8afa7d56f7 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/for-of/source-map.json @@ -0,0 +1,23 @@ +{ + "version": 3, + "names": [ + "_x", + "it", + "_stack", + "x", + "babelHelpers", + "using", + "doSomethingWith", + "_", + "_error", + "_hasError", + "dispose" + ], + "sources": [ + "source-maps/for-of/input.js" + ], + "sourcesContent": [ + "for (using x of it) {\n doSomethingWith(x);\n}" + ], + "mappings": "AAAA,KAAK,MAAMA,EAAC,IAAIC,EAAE,MAAE;EAAA,IAAAC,MAAA;EAAA,MAATC,CAAC,GAAAC,YAAA,CAAAC,KAAA,CAAAH,MAAA,EAAAF,EAAA;EACVM,eAAe,CAACH,CAAC,CAAC;AACpB,CAAC,QAAAI,CAAA;EAAA,IAAAC,MAAA,GAAAD,CAAA;EAAA,IAAAE,SAAA;AAAA;EAAAL,YAAA,CAAAM,OAAA,CAAAR,MAAA,EAAAM,MAAA,EAAAC,SAAA;AAAA" +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/options.json b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/options.json new file mode 100644 index 000000000000..77cc69ab3a21 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/options.json @@ -0,0 +1,4 @@ +{ + "sourceMaps": true, + "plugins": ["proposal-explicit-resource-management"] +} diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/input.mjs b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/input.mjs new file mode 100644 index 000000000000..10f3afd9162d --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/input.mjs @@ -0,0 +1,4 @@ +before; +using x = fn(); +doSomethingWith(x); +after; diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/output.mjs b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/output.mjs new file mode 100644 index 000000000000..8b133b0cc7c8 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/output.mjs @@ -0,0 +1,12 @@ +try { + var _stack = []; + before; + var x = babelHelpers.using(_stack, fn()); + doSomethingWith(x); + after; +} catch (_) { + var _error = _; + var _hasError = true; +} finally { + babelHelpers.dispose(_stack, _error, _hasError); +} diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map-visual.txt b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map-visual.txt new file mode 100644 index 000000000000..c13a8dd9da43 --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map-visual.txt @@ -0,0 +1,134 @@ + (1:0-6) before; <-- (3:2-8) before; + ^^^^^^ ^^^^^^ + + (1:6-7) fore; <-- (3:8-9) fore; + ^ ^ + + (2:0-6) using x = <-- (4:2-6) var x = + ^^^^^^ ^^^^ + + (2:6-7) ing x = f <-- (4:6-7) var x = b + ^ ^ + + (2:7-10) ng x = fn() <-- (4:7-10) ar x = babe + ^^^ ^^^ + + (2:7-10) ng x = fn() <-- (4:10-22) x = babelHelpers.usi + ^^^ ^^^^^^^^^^^^ + + (2:7-10) ng x = fn() <-- (4:22-23) pers.usin + ^^^ ^ + + (2:7-10) ng x = fn() <-- (4:23-28) ers.using(_st + ^^^ ^^^^^ + + (2:7-10) ng x = fn() <-- (4:28-29) sing(_sta + ^^^ ^ + + (2:7-10) ng x = fn() <-- (4:29-35) ing(_stack, fn + ^^^ ^^^^^^ + + (2:7-10) ng x = fn() <-- (4:35-37) tack, fn() + ^^^ ^^ + +(2:10-12) x = fn(); <-- (4:37-39) ck, fn()); + ^^ ^^ + +(2:12-13) = fn(); <-- (4:39-40) , fn()); + ^ ^ + +(2:13-14) fn(); <-- (4:40-41) fn()); + ^ ^ + +(2:14-15) fn(); <-- (4:41-43) fn()); + ^ ^^ + + (3:0-15) doSomethingWith(x); <-- (5:2-17) doSomethingWith(x); + ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ + +(3:15-16) With(x); <-- (5:17-18) With(x); + ^ ^ + +(3:16-17) ith(x); <-- (5:18-19) ith(x); + ^ ^ + +(3:17-18) th(x); <-- (5:19-20) th(x); + ^ ^ + +(3:18-19) h(x); <-- (5:20-21) h(x); + ^ ^ + + (4:0-5) after; <-- (6:2-7) after; + ^^^^^ ^^^^^ + + (4:5-6) fter; <-- (6:7-8) fter; + ^ ^ + + (4:6-6) ter; <-- (7:0-9) } catch (_) { + >< ^^^^^^^^^ + + (4:6-6) ter; <-- (7:9-10) ch (_) { + >< ^ + + (4:6-6) ter; <-- (7:10-13) h (_) { + >< ^^^ + + (4:6-6) ter; <-- (8:2-6) var _err + >< ^^^^ + + (4:6-6) ter; <-- (8:6-12) var _error = _ + >< ^^^^^^ + + (4:6-6) ter; <-- (8:12-15) rror = _; + >< ^^^ + + (4:6-6) ter; <-- (8:15-16) r = _; + >< ^ + + (4:6-6) ter; <-- (8:16-17) = _; + >< ^ + + (4:6-6) ter; <-- (9:2-6) var _has + >< ^^^^ + + (4:6-6) ter; <-- (9:6-15) var _hasError = t + >< ^^^^^^^^^ + + (4:6-6) ter; <-- (9:15-23) rror = true; + >< ^^^^^^^^ + + (4:6-6) ter; <-- (10:0-11) } finally { + >< ^^^^^^^^^^^ + + (4:6-6) ter; <-- (11:2-14) babelHelpers.dis + >< ^^^^^^^^^^^^ + + (4:6-6) ter; <-- (11:14-15) pers.disp + >< ^ + + (4:6-6) ter; <-- (11:15-22) ers.dispose(_st + >< ^^^^^^^ + + (4:6-6) ter; <-- (11:22-23) pose(_sta + >< ^ + + (4:6-6) ter; <-- (11:23-29) ose(_stack, _e + >< ^^^^^^ + + (4:6-6) ter; <-- (11:29-31) tack, _err + >< ^^ + + (4:6-6) ter; <-- (11:31-37) ck, _error, _h + >< ^^^^^^ + + (4:6-6) ter; <-- (11:37-39) rror, _has + >< ^^ + + (4:6-6) ter; <-- (11:39-48) or, _hasError); + >< ^^^^^^^^^ + + (4:6-6) ter; <-- (11:48-50) rror); + >< ^^ + + (4:6-6) ter; <-- (12:0-1) } + >< ^ diff --git a/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map.json b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map.json new file mode 100644 index 000000000000..840392f80f6a --- /dev/null +++ b/packages/babel-plugin-proposal-explicit-resource-management/test/fixtures/source-maps/top-level/source-map.json @@ -0,0 +1,24 @@ +{ + "version": 3, + "names": [ + "before", + "x", + "babelHelpers", + "using", + "_stack", + "fn", + "doSomethingWith", + "after", + "_", + "_error", + "_hasError", + "dispose" + ], + "sources": [ + "source-maps/top-level/input.mjs" + ], + "sourcesContent": [ + "before;\nusing x = fn();\ndoSomethingWith(x);\nafter;" + ], + "mappings": ";;EAAAA,MAAM;EACN,IAAMC,CAAC,GAAAC,YAAA,CAAAC,KAAA,CAAAC,MAAA,EAAGC,EAAE,CAAC,CAAC;EACdC,eAAe,CAACL,CAAC,CAAC;EAClBM,KAAK;AAAC,SAAAC,CAAA;EAAA,IAAAC,MAAA,GAAAD,CAAA;EAAA,IAAAE,SAAA;AAAA;EAAAR,YAAA,CAAAS,OAAA,CAAAP,MAAA,EAAAK,MAAA,EAAAC,SAAA;AAAA" +} \ No newline at end of file