Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix destructured exports - adds a failing test based on description in #5768 - handles ObjectPattern and ArrayPattern * use export assignment template
- Loading branch information
Showing
3 changed files
with
82 additions
and
11 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
14 changes: 14 additions & 0 deletions
14
...gin-transform-es2015-modules-commonjs/test/fixtures/interop/export-destructured/actual.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export let x = 0; | ||
export let y = 0; | ||
|
||
export function f1 () { | ||
({x} = { x: 1 }); | ||
} | ||
|
||
export function f2 () { | ||
({x, y} = { x: 2, y: 3 }); | ||
} | ||
|
||
export function f3 () { | ||
[x, y, z] = [3, 4, 5] | ||
} |
27 changes: 27 additions & 0 deletions
27
...n-transform-es2015-modules-commonjs/test/fixtures/interop/export-destructured/expected.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.f1 = f1; | ||
exports.f2 = f2; | ||
exports.f3 = f3; | ||
let x = exports.x = 0; | ||
let y = exports.y = 0; | ||
|
||
function f1() { | ||
({ x } = { x: 1 }); | ||
exports.x = x; | ||
} | ||
|
||
function f2() { | ||
({ x, y } = { x: 2, y: 3 }); | ||
exports.y = y; | ||
exports.x = x; | ||
} | ||
|
||
function f3() { | ||
[x, y, z] = [3, 4, 5]; | ||
exports.y = y; | ||
exports.x = x; | ||
} |