Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
Fix: UpdateExpression detection and operator format (fixes #58) (#59)
Browse files Browse the repository at this point in the history
* Fix: UpdateExpression detection and operator format (fixes #58)

* Added basics in fixtures with update-expression test
  • Loading branch information
JamesHenry authored and nzakas committed Aug 21, 2016
1 parent e09ebb3 commit 8f4964c
Show file tree
Hide file tree
Showing 4 changed files with 680 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ast-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1419,10 +1419,11 @@ module.exports = function(ast, extra) {

case SyntaxKind.PrefixUnaryExpression:
case SyntaxKind.PostfixUnaryExpression:
var operator = TOKEN_TO_TEXT[node.operator];
assign(result, {
// ESTree uses UpdateExpression for ++/--
type: /^(?:\+\+|\-\-)$/.test(TOKEN_TO_TEXT[node.operator.kind]) ? "UpdateExpression" : "UnaryExpression",
operator: SyntaxKind[node.operator],
type: /^(?:\+\+|\-\-)$/.test(operator) ? "UpdateExpression" : "UnaryExpression",
operator: operator,
prefix: node.kind === SyntaxKind.PrefixUnaryExpression,
argument: convertChild(node.operand)
});
Expand Down
Loading

0 comments on commit 8f4964c

Please sign in to comment.