Correctly handle UpdateExpressions (a++, a--) that are directly following AssignmentExpressions.

Closes #492
This commit is contained in:
Jürg Lehni 2014-07-26 12:29:05 +02:00
parent 6e6df750f0
commit 54f0197eba

View file

@ -229,8 +229,11 @@ Base.exports.PaperScript = (function() {
if (node.type === 'UpdateExpression') {
if (!node.prefix) {
var arg = getCode(node.argument);
replaceCode(node, arg + ' = __$__(' + arg + ', "'
+ node.operator[0] + '", 1)');
var str = arg + ' = __$__(' + arg
+ ', "' + node.operator[0] + '", 1)';
if (parent.type === 'AssignmentExpression')
str = arg + '; ' + str;
replaceCode(node, str);
}
} else { // AssignmentExpression
if (/^.=$/.test(node.operator)