mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Correctly handle UpdateExpressions (a++, a--) that are directly following AssignmentExpressions.
Closes #492
This commit is contained in:
parent
6e6df750f0
commit
54f0197eba
1 changed files with 5 additions and 2 deletions
|
@ -229,8 +229,11 @@ Base.exports.PaperScript = (function() {
|
||||||
if (node.type === 'UpdateExpression') {
|
if (node.type === 'UpdateExpression') {
|
||||||
if (!node.prefix) {
|
if (!node.prefix) {
|
||||||
var arg = getCode(node.argument);
|
var arg = getCode(node.argument);
|
||||||
replaceCode(node, arg + ' = __$__(' + arg + ', "'
|
var str = arg + ' = __$__(' + arg
|
||||||
+ node.operator[0] + '", 1)');
|
+ ', "' + node.operator[0] + '", 1)';
|
||||||
|
if (parent.type === 'AssignmentExpression')
|
||||||
|
str = arg + '; ' + str;
|
||||||
|
replaceCode(node, str);
|
||||||
}
|
}
|
||||||
} else { // AssignmentExpression
|
} else { // AssignmentExpression
|
||||||
if (/^.=$/.test(node.operator)
|
if (/^.=$/.test(node.operator)
|
||||||
|
|
Loading…
Reference in a new issue