Skip to content

Commit

Permalink
Merge pull request #831 from null-a/fix-760
Browse files Browse the repository at this point in the history
Fix bug directly calling conditional
  • Loading branch information
stuhlmueller committed Apr 21, 2017
2 parents 5e91397 + 1dd4676 commit 83adc18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function isPrimitive(node) {
case Syntax.FunctionExpression:
case Syntax.Identifier:
case Syntax.CallExpression:
case Syntax.ConditionalExpression:
return false;
case Syntax.MemberExpression:
return (types.Identifier.check(node.object) ||
Expand Down
9 changes: 8 additions & 1 deletion tests/test-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,14 @@ var tests = {
'var a = ((x === undefined) ? false : id(x.foo)) || true;',
'a'
].join('\n'),
expected: true }
expected: true },

{ name: 'testConditional5',
code: [
'var id = function(x){return x};',
'(true ? id : id)(0)'
].join('\n'),
expected: 0 }

],

Expand Down

0 comments on commit 83adc18

Please sign in to comment.