Skip to content

Commit c3ea1d2

Browse files
g-planeJamesHenry
authored andcommitted
fix(ast): fix wrong node type on literal expressions (JamesHenry#4)
BREAKING CHANGE: This changes the AST
1 parent ba9cfff commit c3ea1d2

File tree

4 files changed

+704
-0
lines changed

4 files changed

+704
-0
lines changed

lib/convert.js

+4
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ module.exports = function convert(config) {
746746
if (arrayAssignNode) {
747747
if (arrayAssignNode.left === node) {
748748
arrayIsInAssignment = true;
749+
} else if (node.parent.kind === SyntaxKind.CallExpression) {
750+
arrayIsInAssignment = false;
749751
} else {
750752
arrayIsInAssignment =
751753
nodeUtils.findChildOfKind(
@@ -790,6 +792,8 @@ module.exports = function convert(config) {
790792
if (objectAssignNode) {
791793
if (objectAssignNode.left === node) {
792794
objectIsInAssignment = true;
795+
} else if (node.parent.kind === SyntaxKind.CallExpression) {
796+
objectIsInAssignment = false;
793797
} else {
794798
objectIsInAssignment =
795799
nodeUtils.findChildOfKind(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn([]).x = obj;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn({}).x = obj;

0 commit comments

Comments
 (0)