Skip to content

Increment and decrement operators are incorrectly marked as repeatable #878

@alangpierce

Description

@alangpierce

decaffeinate is producing the wrong JavaScript based on my CoffeeScript input:

n = 1
(n++)?.toString()
console.log n

(repl)

I get this output:

let n = 1;
if (n++ != null) {
  (n++).toString();
}
console.log(n);

Here's what I expect it to be instead:

let ref;
let n = 1;
if ((ref = n++) != null) {
  ref.toString();
}
console.log(n);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions