forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request webpack#5058 from webpack/bugfix/renaming-shorthand
rename shorthand properties correctly
- Loading branch information
Showing
8 changed files
with
116 additions
and
1 deletion.
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 @@ | ||
export var test = "test1"; |
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,2 @@ | ||
var [ test ] = [ "test2" ]; | ||
export { test } |
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,2 @@ | ||
var { test } = { test: "test3" }; | ||
export { test } |
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,2 @@ | ||
var {o:[{ test }]} = {o:[{ test: "test4" }]}; | ||
export { test } |
25 changes: 25 additions & 0 deletions
25
test/cases/scope-hoisting/renaming-shorthand-5027/index.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,25 @@ | ||
import m from "./module"; | ||
|
||
it("should apply shorthand properties correctly when renaming", function() { | ||
m.should.be.eql({ | ||
obj: { | ||
test: "test1", | ||
test2: "test2", | ||
test3: "test3", | ||
test4: "test4" | ||
}, | ||
nested: { | ||
array: [{ | ||
test: "test1", | ||
test2: "test2", | ||
test3: "test3", | ||
test4: "test4" | ||
}] | ||
}, | ||
test: "test1", | ||
test2: "test2", | ||
test3: "test3", | ||
test4: "test4", | ||
f: ["test2", "test2", "test3"] | ||
}) | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/cases/scope-hoisting/renaming-shorthand-5027/module.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,21 @@ | ||
import { test } from './file1'; | ||
import { test as test2 } from './file2'; | ||
import { test as test3 } from './file3'; | ||
import { test as test4 } from './file4'; | ||
|
||
var obj = { test, test2, test3, test4 }; | ||
var nested = { array: [ { test, test2, test3, test4 }]}; | ||
|
||
function f(test = test2, { test2: t2 } = { test2 }, { t3 = test3 } = {}) { | ||
return [test, t2, t3]; | ||
} | ||
|
||
export default { | ||
obj, | ||
nested, | ||
test, | ||
test2, | ||
test3, | ||
test4, | ||
f: f() | ||
}; |
12 changes: 12 additions & 0 deletions
12
test/cases/scope-hoisting/renaming-shorthand-5027/test.filter.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,12 @@ | ||
var supportsES6 = require("../../../helpers/supportsES6"); | ||
var supportDefaultAssignment = require("../../../helpers/supportDefaultAssignment"); | ||
var supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring"); | ||
var supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring"); | ||
|
||
module.exports = function(config) { | ||
return !config.minimize && | ||
supportsES6() && | ||
supportDefaultAssignment() && | ||
supportsObjectDestructuring() && | ||
supportsIteratorDestructuring(); | ||
}; |