[js] Fix object property with method type

Fix #3948
This commit is contained in:
Clément Fournier
2022-05-02 19:13:51 +02:00
parent 86891b0c6d
commit d39ff7df9b
4 changed files with 19 additions and 1 deletions

View File

@ -27,7 +27,7 @@ public class AbstractInfixEcmascriptNode<T extends InfixExpression> extends Abst
if (setImage) {
if (infixExpression.getOperator() == Token.ASSIGN_BITXOR) {
super.setImage("^=");
} else {
} else if (infixExpression.getOperator() != Token.METHOD) {
super.setImage(AstRoot.operatorToString(infixExpression.getOperator()));
}
}

View File

@ -40,4 +40,10 @@ public class JsTreeDumpTest extends BaseTreeDumpTest {
public void templateStrings() {
doTest("templateStrings");
}
@Test
public void issue3948() {
// https://github.com/pmd/pmd/issues/3948
doTest("issue3948");
}
}

View File

@ -0,0 +1,3 @@
x = {
init() { }
};

View File

@ -0,0 +1,9 @@
+- AstRoot
+- ExpressionStatement
+- Assignment
+- Name
+- ObjectLiteral
+- ObjectProperty
+- Name
+- FunctionNode
+- Block