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 #1717 from rollup/fix-sequence-expressions
Fix sequence expressions
- Loading branch information
Showing
8 changed files
with
86 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
define(function () { 'use strict'; | ||
|
||
// should remove expressions without side-effect, multiple effects | ||
var a = (foo(), foo(), 2); | ||
// without white-space, effect at the end | ||
var b = (foo()); | ||
function foo$1 () { | ||
console.log( 'foo' ); | ||
} | ||
|
||
// should only keep final expression | ||
var d = (2); | ||
console.log(d); | ||
// should remove expressions without side-effect, multiple effects | ||
var a = (foo(), foo(), 2); | ||
// without white-space, effect at the end | ||
var b = (foo()); | ||
|
||
// should infer value | ||
// should only keep final expression | ||
var d = (2); | ||
console.log(d); | ||
|
||
// should infer value | ||
// should keep f import | ||
var e = (foo$1()); | ||
|
||
// should properly render complex sub-expressions | ||
var g = ((() => {console.log(foo$1());})(), 1); | ||
|
||
}); |
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 |
---|---|---|
@@ -1,15 +1,24 @@ | ||
(function () { | ||
'use strict'; | ||
'use strict'; | ||
|
||
// should remove expressions without side-effect, multiple effects | ||
var a = (foo(), foo(), 2); | ||
// without white-space, effect at the end | ||
var b = (foo()); | ||
function foo$1 () { | ||
console.log( 'foo' ); | ||
} | ||
|
||
// should only keep final expression | ||
var d = (2); | ||
console.log(d); | ||
// should remove expressions without side-effect, multiple effects | ||
var a = (foo(), foo(), 2); | ||
// without white-space, effect at the end | ||
var b = (foo()); | ||
|
||
// should infer value | ||
// should only keep final expression | ||
var d = (2); | ||
console.log(d); | ||
|
||
// should infer value | ||
// should keep f import | ||
var e = (foo$1()); | ||
|
||
// should properly render complex sub-expressions | ||
var g = ((() => {console.log(foo$1());})(), 1); | ||
|
||
}()); |
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 |
---|---|---|
@@ -1,18 +1,27 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(factory()); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(factory()); | ||
}(this, (function () { 'use strict'; | ||
|
||
// should remove expressions without side-effect, multiple effects | ||
var a = (foo(), foo(), 2); | ||
// without white-space, effect at the end | ||
var b = (foo()); | ||
function foo$1 () { | ||
console.log( 'foo' ); | ||
} | ||
|
||
// should only keep final expression | ||
var d = (2); | ||
console.log(d); | ||
// should remove expressions without side-effect, multiple effects | ||
var a = (foo(), foo(), 2); | ||
// without white-space, effect at the end | ||
var b = (foo()); | ||
|
||
// should infer value | ||
// should only keep final expression | ||
var d = (2); | ||
console.log(d); | ||
|
||
// should infer value | ||
// should keep f import | ||
var e = (foo$1()); | ||
|
||
// should properly render complex sub-expressions | ||
var g = ((() => {console.log(foo$1());})(), 1); | ||
|
||
}))); |
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,3 @@ | ||
export function foo () { | ||
console.log( 'foo' ); | ||
} |
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