]
Gorkem Ercan updated ERT-354:
-----------------------------
Story Points: 10
ASTParser does not parse expressions like `var a = b;` correctly.
[EBZ#498370]
------------------------------------------------------------------------------
Key: ERT-354
URL:
https://issues.jboss.org/browse/ERT-354
Project: Eclipse Release Train
Issue Type: Task
Components: JSDT
Reporter: Friendly Jira Robot
Labels: General, bzira
The AST generated by org.eclipse.wst.jsdt.core.dom.ASTParser.createAST() is incorrect.
For the expression `var a = b`, the AST does not recognize `a` as the variable, instead
representing the statement as `var b`
E.g. (Parentheses indicate the ASTNode's toString())
Statement: var b = 15;
AST:
[...]
VariableDeclarationStatement (var b=20)
InferredType
VariableDeclarationFragment (b=20)
SimpleName (b)
NumberLiteral (20)
Statement: var b = a;
AST:
[...]
VariableDeclarationStatement (var a)
InferredType
VariableDeclarationFragment (a)
SimpleName (a)
The problem is not present for other node types (e.g. Assignment), not is it present when
the right-hand-side contains an expression (e.g. `var c = b + a`)