Browse Source

Merge branch '1032' of https://github.com/kzc/rollup into kzc-1032

legacy-quote-reserved-properties
Rich Harris 8 years ago
parent
commit
1559aaba22
  1. 2
      src/ast/nodes/shared/callHasEffects.js
  2. 4
      test/function/braceless-arrow-function-returning-function/_config.js
  3. 7
      test/function/braceless-arrow-function-returning-function/main.js

2
src/ast/nodes/shared/callHasEffects.js

@ -11,7 +11,7 @@ function fnHasEffects ( fn ) {
// handle body-less arrow functions
const scope = fn.body.scope || fn.scope;
const body = fn.body.body || [ fn.body ];
const body = Array.isArray(fn.body.body) && fn.body.body || [ fn.body ];
for ( const node of body ) {
if ( node.hasEffects( scope ) ) {

4
test/function/braceless-arrow-function-returning-function/_config.js

@ -0,0 +1,4 @@
module.exports = {
description: 'arrow function without braces returning a function (#1032)',
buble: true
};

7
test/function/braceless-arrow-function-returning-function/main.js

@ -0,0 +1,7 @@
const f = (a) => (b) => { return a * b }
function ff (a) { return f(a) }
assert.equal( ff(2)(3), 6 );
const g = (a) => { return (b) => { return a - b } }
function gg (a) { return g(a) }
assert.equal( gg(2)(3), -1 );
Loading…
Cancel
Save