Skip to content

Commit 6bbc5ae

Browse files
committed
1547 use strict: delete operands restricted
1 parent 6c9ded8 commit 6bbc5ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/nodes.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,10 @@ exports.Op = class Op extends Base
14371437
# In chains, there's no need to wrap bare obj literals in parens,
14381438
# as the chained expression is wrapped.
14391439
@first.front = @front unless isChain
1440+
if @operator is 'delete' and o.scope.check(@first.unwrapAll().value)
1441+
throw SyntaxError 'delete operand may not be argument or var'
1442+
if @operator in ['--', '++'] and @first.unwrapAll().value in STRICT_PROSCRIBED
1443+
throw SyntaxError 'prefix increment/decrement may not have eval or arguments operand'
14401444
return @compileUnary o if @isUnary()
14411445
return @compileChain o if isChain
14421446
return @compileExistence o if @operator is '?'

0 commit comments

Comments
 (0)