Don't throw when destructuring into a var named as an import (#10628)

This commit is contained in:
Nicolò Ribaudo
2019-11-04 22:50:36 +01:00
committed by GitHub
parent 5e24016623
commit 43aa7e262c
3 changed files with 48 additions and 15 deletions

View File

@@ -0,0 +1,12 @@
import { foo } from "x";
function f(foo) {
foo = 2;
[foo] = [];
({ foo } = {});
}
foo = 2;
[foo] = [];
({ foo } = {});

View File

@@ -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.');
}()));