Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Properly treat mutations of the results of logical expressions
* Resolve #1599
- Loading branch information
1 parent
7148ed5
commit a83b309
Showing
9 changed files
with
191 additions
and
0 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
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,4 @@ | ||
module.exports = { | ||
description: 'properly handle the results of mutating logical expressions', | ||
options: { name: 'bundle' } | ||
}; |
26 changes: 26 additions & 0 deletions
26
test/form/samples/mutate-logical-expression/_expected/amd.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,26 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
var aExp = {}; | ||
var logicalAExp = aExp || true; | ||
logicalAExp.bar = 1; | ||
|
||
var bExp = {}; | ||
var cExp = {}; | ||
var logicalCExp = false || cExp; | ||
logicalCExp.bar = 1; | ||
|
||
var dExp = {}; | ||
var logicalDExp = true && dExp; | ||
logicalDExp.bar = 1; | ||
|
||
var eExp = {}; | ||
|
||
exports.aExp = aExp; | ||
exports.bExp = bExp; | ||
exports.cExp = cExp; | ||
exports.dExp = dExp; | ||
exports.eExp = eExp; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
24 changes: 24 additions & 0 deletions
24
test/form/samples/mutate-logical-expression/_expected/cjs.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,24 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var aExp = {}; | ||
var logicalAExp = aExp || true; | ||
logicalAExp.bar = 1; | ||
|
||
var bExp = {}; | ||
var cExp = {}; | ||
var logicalCExp = false || cExp; | ||
logicalCExp.bar = 1; | ||
|
||
var dExp = {}; | ||
var logicalDExp = true && dExp; | ||
logicalDExp.bar = 1; | ||
|
||
var eExp = {}; | ||
|
||
exports.aExp = aExp; | ||
exports.bExp = bExp; | ||
exports.cExp = cExp; | ||
exports.dExp = dExp; | ||
exports.eExp = eExp; |
16 changes: 16 additions & 0 deletions
16
test/form/samples/mutate-logical-expression/_expected/es.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,16 @@ | ||
var aExp = {}; | ||
var logicalAExp = aExp || true; | ||
logicalAExp.bar = 1; | ||
|
||
var bExp = {}; | ||
var cExp = {}; | ||
var logicalCExp = false || cExp; | ||
logicalCExp.bar = 1; | ||
|
||
var dExp = {}; | ||
var logicalDExp = true && dExp; | ||
logicalDExp.bar = 1; | ||
|
||
var eExp = {}; | ||
|
||
export { aExp, bExp, cExp, dExp, eExp }; |
27 changes: 27 additions & 0 deletions
27
test/form/samples/mutate-logical-expression/_expected/iife.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 @@ | ||
var bundle = (function (exports) { | ||
'use strict'; | ||
|
||
var aExp = {}; | ||
var logicalAExp = aExp || true; | ||
logicalAExp.bar = 1; | ||
|
||
var bExp = {}; | ||
var cExp = {}; | ||
var logicalCExp = false || cExp; | ||
logicalCExp.bar = 1; | ||
|
||
var dExp = {}; | ||
var logicalDExp = true && dExp; | ||
logicalDExp.bar = 1; | ||
|
||
var eExp = {}; | ||
|
||
exports.aExp = aExp; | ||
exports.bExp = bExp; | ||
exports.cExp = cExp; | ||
exports.dExp = dExp; | ||
exports.eExp = eExp; | ||
|
||
return exports; | ||
|
||
}({})); |
30 changes: 30 additions & 0 deletions
30
test/form/samples/mutate-logical-expression/_expected/umd.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,30 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.bundle = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
|
||
var aExp = {}; | ||
var logicalAExp = aExp || true; | ||
logicalAExp.bar = 1; | ||
|
||
var bExp = {}; | ||
var cExp = {}; | ||
var logicalCExp = false || cExp; | ||
logicalCExp.bar = 1; | ||
|
||
var dExp = {}; | ||
var logicalDExp = true && dExp; | ||
logicalDExp.bar = 1; | ||
|
||
var eExp = {}; | ||
|
||
exports.aExp = aExp; | ||
exports.bExp = bExp; | ||
exports.cExp = cExp; | ||
exports.dExp = dExp; | ||
exports.eExp = eExp; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}))); |
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,49 @@ | ||
var a = {}; | ||
var logicalA = a || true; | ||
logicalA.bar = 1; | ||
|
||
var aExp = {}; | ||
var logicalAExp = aExp || true; | ||
logicalAExp.bar = 1; | ||
|
||
export {aExp} | ||
|
||
var b = {}; | ||
var logicalB = true || b; | ||
logicalB.bar = 1; | ||
|
||
var bExp = {}; | ||
var logicalBExp = true || bExp; | ||
logicalBExp.bar = 1; | ||
|
||
export {bExp} | ||
|
||
var c = {}; | ||
var logicalC = false || c; | ||
logicalC.bar = 1; | ||
|
||
var cExp = {}; | ||
var logicalCExp = false || cExp; | ||
logicalCExp.bar = 1; | ||
|
||
export {cExp} | ||
|
||
var d = {}; | ||
var logicalD = true && d; | ||
logicalD.bar = 1; | ||
|
||
var dExp = {}; | ||
var logicalDExp = true && dExp; | ||
logicalDExp.bar = 1; | ||
|
||
export {dExp} | ||
|
||
var e = {}; | ||
var logicalE = false && e; | ||
logicalE.bar = 1; | ||
|
||
var eExp = {}; | ||
var logicalEExp = false && eExp; | ||
logicalEExp.bar = 1; | ||
|
||
export {eExp} |