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

Commit 8f4964c

Browse files
JamesHenrynzakas
authored andcommitted
Fix: UpdateExpression detection and operator format (fixes #58) (#59)
* Fix: UpdateExpression detection and operator format (fixes #58) * Added basics in fixtures with update-expression test
1 parent e09ebb3 commit 8f4964c

File tree

4 files changed

+680
-2
lines changed

4 files changed

+680
-2
lines changed

lib/ast-converter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,10 +1419,11 @@ module.exports = function(ast, extra) {
14191419

14201420
case SyntaxKind.PrefixUnaryExpression:
14211421
case SyntaxKind.PostfixUnaryExpression:
1422+
var operator = TOKEN_TO_TEXT[node.operator];
14221423
assign(result, {
14231424
// ESTree uses UpdateExpression for ++/--
1424-
type: /^(?:\+\+|\-\-)$/.test(TOKEN_TO_TEXT[node.operator.kind]) ? "UpdateExpression" : "UnaryExpression",
1425-
operator: SyntaxKind[node.operator],
1425+
type: /^(?:\+\+|\-\-)$/.test(operator) ? "UpdateExpression" : "UnaryExpression",
1426+
operator: operator,
14261427
prefix: node.kind === SyntaxKind.PrefixUnaryExpression,
14271428
argument: convertChild(node.operand)
14281429
});

0 commit comments

Comments
 (0)