fixing calling super from constructors

This commit is contained in:
Jeremy Ashkenas
2010-01-08 10:54:44 -05:00
parent 8b3926fb0c
commit 4c3f00cf77
2 changed files with 17 additions and 1 deletions

View File

@@ -243,7 +243,9 @@ module CoffeeScript
def compile_super(args, o)
methname = o[:last_assign]
arg_part = args.empty? ? '' : ", #{args}"
"#{o[:proto_assign]}.__superClass__.#{methname}.call(this#{arg_part})"
meth = o[:proto_assign] ? "#{o[:proto_assign]}.__superClass__.#{methname}" :
"#{methname}.__superClass__.constructor"
"#{meth}.call(this#{arg_part})"
end
def compile_splat(o)