mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -05:00
making extends equivalent to the Google Closure version
This commit is contained in:
@@ -269,9 +269,12 @@ module CoffeeScript
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile_node(o={})
|
def compile_node(o={})
|
||||||
|
constructor = o[:scope].free_variable
|
||||||
sub, sup = @sub_object.compile(o), @super_object.compile(o)
|
sub, sup = @sub_object.compile(o), @super_object.compile(o)
|
||||||
"#{idt}#{sub}.__superClass__ = #{sup}.prototype;\n#{idt}" +
|
"#{idt}#{constructor} = function(){};\n#{idt}" +
|
||||||
"#{sub}.prototype = new #{sup}();\n#{idt}" +
|
"#{constructor}.prototype = #{sup}.prototype;\n#{idt}" +
|
||||||
|
"#{sub}.__superClass__ = #{sup}.prototype;\n#{idt}" +
|
||||||
|
"#{sub}.prototype = new #{constructor}();\n#{idt}" +
|
||||||
"#{sub}.prototype.constructor = #{sub};"
|
"#{sub}.prototype.constructor = #{sub};"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user