[jbosstools-issues] [JBoss JIRA] (ERT-354) ASTParser does not parse expressions like `var a = b; ` correctly. [EBZ#498370]

Friendly Jira Robot (JIRA) issues at jboss.org
Fri Jul 22 17:26:00 EDT 2016


Friendly Jira Robot created ERT-354:
---------------------------------------

             Summary: 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


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`)



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jbosstools-issues mailing list