diff --git a/lib/validate.js b/lib/validate.js index dc95adf..72a2aa1 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -794,6 +794,7 @@ Vp.expression = function expression(e) { when({ type: 'AssignmentExpression', + operator: '=', left: match.var('left', { type: match.some('Identifier', 'MemberExpression') }), right: match.var('right') }, function(vars) { diff --git a/test/index.js b/test/index.js index a787115..6a540b6 100644 --- a/test/index.js +++ b/test/index.js @@ -354,3 +354,11 @@ exports.testForWithoutUpdate = asmAssert.one( } }, { pass: true }); + +exports.testCompoundAssignment = asmAssert.one( + "compound assignment operations such as += are disallowed", + function f() { + var x = 0; + x += 1; + }, + { pass: false });