Applied the new splat flexibility to function currying operator

This commit is contained in:
matehat
2010-03-17 12:52:59 -04:00
parent 5be437deb9
commit 3b22018296
2 changed files with 18 additions and 2 deletions

View File

@@ -405,11 +405,16 @@ exports.CurryNode: class CurryNode extends CallNode
constructor: (meth, bind, args) ->
@children: flatten [@meth: meth, @bind: bind or literal('this'), @args: (args or [])]
arguments: (o) ->
for arg in @args
return literal(@compile_splat_arguments(o)) if arg instanceof SplatNode
new ArrayNode(@args)
compile_node: (o) ->
o.scope.assign('__curry', @code, true)
o.scope.assign('__slice', @slice, true)
ref: new ValueNode literal('__curry')
call: new CallNode ref, [@meth, @bind, new ArrayNode(@args)]
call: new CallNode ref, [@meth, @bind, @arguments(o)]
call.compile(o)