mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -05:00
removing arguments as a keyword -- we can detect its use at code-generation time.
This commit is contained in:
@@ -153,7 +153,7 @@ module CoffeeScript
|
||||
# at the top.
|
||||
def compile_with_declarations(o={})
|
||||
code = compile_node(o)
|
||||
args = self.contains? {|n| n.is_a?(LiteralNode) && n.arguments? }
|
||||
args = self.contains? {|n| n.is_a?(ValueNode) && n.arguments? }
|
||||
argv = args && o[:scope].check('arguments') ? '' : 'var '
|
||||
code = "#{idt}#{argv}arguments = Array.prototype.slice.call(arguments, 0);\n#{code}" if args
|
||||
code = "#{idt}var #{o[:scope].compiled_assignments};\n#{code}" if o[:scope].assignments?(self)
|
||||
@@ -203,10 +203,6 @@ module CoffeeScript
|
||||
end
|
||||
alias_method :statement_only?, :statement?
|
||||
|
||||
def arguments?
|
||||
@value.to_s == 'arguments'
|
||||
end
|
||||
|
||||
def compile_node(o)
|
||||
indent = statement? ? idt : ''
|
||||
ending = statement? ? ';' : ''
|
||||
@@ -361,6 +357,10 @@ module CoffeeScript
|
||||
properties? && @properties.last.is_a?(SliceNode)
|
||||
end
|
||||
|
||||
def arguments?
|
||||
@base.to_s == 'arguments'
|
||||
end
|
||||
|
||||
def unwrap
|
||||
@properties.empty? ? @base : self
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user