forked from decaffeinate/decaffeinate
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: treat increment and decrement ops as non-repeatable
Fixes decaffeinate#878
- Loading branch information
1 parent
57fda31
commit e0151b0
Showing
3 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import NodePatcher from '../../../patchers/NodePatcher'; | ||
import type { PatcherContext } from '../../../patchers/types'; | ||
|
||
export default class IncrementDecrementPatcher extends NodePatcher { | ||
expression: NodePatcher; | ||
|
||
constructor(patcherContext: PatcherContext, expression: NodePatcher) { | ||
super(patcherContext); | ||
this.expression = expression; | ||
} | ||
|
||
initialize() { | ||
this.expression.setRequiresExpression(); | ||
} | ||
|
||
patchAsExpression() { | ||
this.expression.patch(); | ||
} | ||
|
||
isRepeatable() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters