From 54f0197ebae4f9b23be67813b0766c7e0274f6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 26 Jul 2014 12:29:05 +0200 Subject: [PATCH] Correctly handle UpdateExpressions (a++, a--) that are directly following AssignmentExpressions. Closes #492 --- src/core/PaperScript.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 841ad786..f8d37c36 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -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)