Skip to content

Commit

Permalink
Merge pull request jashkenas#2057 from geraldalewis/2054_{arguments}
Browse files Browse the repository at this point in the history
Issue jashkenas#2054 "{arguments}"
  • Loading branch information
jashkenas committed Jan 20, 2012
2 parents 7c56da2 + c3a8a4f commit 8ac440f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/coffee-script/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/nodes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,8 @@ exports.Assign = class Assign extends Base
constructor: (@variable, @value, @context, options) ->
@param = options and options.param
@subpattern = options and options.subpattern
if name = @variable.unwrapAll().value in STRICT_PROSCRIBED
forbidden = (name = @variable.unwrapAll().value) in STRICT_PROSCRIBED
if forbidden and @context isnt 'object'
throw SyntaxError "variable name may not be \"#{name}\""

children: ['variable', 'value']
Expand Down
5 changes: 5 additions & 0 deletions test/strict.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ test "`Future Reserved Word`s, `eval` and `arguments` restrictions", ->
check "++{keyword}"
check "{keyword}--"
check "--{keyword}"
destruct = (keyword, check = strict) ->
check "{#{keyword}}"
check "o = {#{keyword}}"
invoke = (keyword, check = strict) ->
check "#{keyword} yes"
check "do #{keyword}"
Expand All @@ -134,6 +137,7 @@ test "`Future Reserved Word`s, `eval` and `arguments` restrictions", ->
for keyword in future
access keyword
assign keyword
destruct keyword
invoke keyword
fnDecl keyword
param keyword
Expand All @@ -143,6 +147,7 @@ test "`Future Reserved Word`s, `eval` and `arguments` restrictions", ->
for keyword in ['eval', 'arguments']
access keyword, strictOk
assign keyword
destruct keyword, strictOk
invoke keyword, strictOk
fnDecl keyword
param keyword
Expand Down

0 comments on commit 8ac440f

Please sign in to comment.