Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[javascript] Support for-of loop #2379

Closed
hudec117 opened this issue Mar 23, 2020 · 0 comments · Fixed by #2418
Closed

[javascript] Support for-of loop #2379

hudec117 opened this issue Mar 23, 2020 · 0 comments · Fixed by #2418
Labels
a:bug PMD crashes or fails to analyse a file.
Milestone

Comments

@hudec117
Copy link

hudec117 commented Mar 23, 2020

Affects PMD Version:

6.22.0

Description:

The for-of loop is recognised incorrectly as an "EmptyStatement".

That's an ES6 / ECMAScript 2015 feature.

It seems to be partially supported by Rhino: http://mozilla.github.io/rhino/compat/engines.html

Code Sample demonstrating the issue:

// Generates "ForInLoop" in AST
for (var item in items) {}

// Generate "EmptyStatement" in AST
for (var item of items) {}
for (let item of items) {}
for (const item of items) {}

image

Steps to reproduce:

  1. Start PMD Designer
  2. Set language to Ecmascript
  3. Copy-paste code sample from above
  4. Observe AST for incorrect "EmptyStatement"

Running PMD through: Designer

Related issues: #2305 #1235 #699

@adangel adangel added the a:bug PMD crashes or fails to analyse a file. label Apr 16, 2020
@adangel adangel added the has:pr label Apr 16, 2020
@adangel adangel added this to the 6.23.0 milestone Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug PMD crashes or fails to analyse a file.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants