Fixed #669: Wrapper arguments

This commit is contained in:
Stan Angeloff
2010-09-08 15:18:08 +03:00
parent 9290e508c6
commit cd6261d477
2 changed files with 16 additions and 3 deletions

View File

@@ -474,13 +474,16 @@ exports.CallNode = class CallNode extends BaseNode
obj = temp
meth = "(#{temp} = #{ @variable.source })#{ @variable.last }"
if @isNew
mentionsArgs = no
for arg in @args
arg.contains (n) -> mentionsArgs or= n instanceof LiteralNode and (n.value is 'arguments')
utility 'extends'
"""
#{@first}(function() {
#{@idt(1)}var ctor = function(){};
#{@idt(1)}__extends(ctor, #{meth});
#{@idt(1)}return #{meth}.apply(new ctor, #{ @compileSplatArguments(o) });
#{@tab}}).call(this)#{@last}
#{@tab}}).#{ if mentionsArgs then 'apply(this, arguments)' else 'call(this)'}#{@last}
"""
else
"#{@first}#{@prefix()}#{meth}.apply(#{obj}, #{ @compileSplatArguments(o) })#{@last}"