Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't throw when destructuring into a var named as an import (#10628)
- Loading branch information
1 parent
5e24016
commit 43aa7e2
Showing
3 changed files
with
48 additions
and
15 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
12 changes: 12 additions & 0 deletions
12
...bel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs
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,12 @@ | ||
import { foo } from "x"; | ||
|
||
function f(foo) { | ||
foo = 2; | ||
[foo] = []; | ||
({ foo } = {}); | ||
} | ||
|
||
|
||
foo = 2; | ||
[foo] = []; | ||
({ foo } = {}); |
23 changes: 23 additions & 0 deletions
23
...bel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.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,23 @@ | ||
"use strict"; | ||
|
||
var _x = require("x"); | ||
|
||
function f(foo) { | ||
foo = 2; | ||
[foo] = []; | ||
({ | ||
foo | ||
} = {}); | ||
} | ||
|
||
_x.foo = (2, function () { | ||
throw new Error('"' + "foo" + '" is read-only.'); | ||
}()); | ||
[foo] = ([], function () { | ||
throw new Error('"' + "foo" + '" is read-only.'); | ||
}()); | ||
({ | ||
foo | ||
} = ({}, function () { | ||
throw new Error('"' + "foo" + '" is read-only.'); | ||
}())); |