1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
jashkenas--coffeescript/test/fixtures/execution/test_calling_super.coffee
2010-01-08 10:54:44 -05:00

38 lines
No EOL
715 B
CoffeeScript

Base: =>
Base.prototype.func: string =>
'zero/' + string
FirstChild: =>
FirstChild extends Base
FirstChild.prototype.func: string =>
super('one/') + string
SecondChild: =>
SecondChild extends FirstChild
SecondChild.prototype.func: string =>
super('two/') + string
ThirdChild: =>
this.array: [1, 2, 3]
ThirdChild extends SecondChild
ThirdChild.prototype.func: string =>
super('three/') + string
result: (new ThirdChild()).func('four')
print(result is 'zero/one/two/three/four')
TopClass: arg =>
this.prop: 'top-' + arg
SuperClass: arg =>
super('super-' + arg)
SubClass: =>
super('sub')
SuperClass extends TopClass
SubClass extends SuperClass
print((new SubClass()).prop is 'top-super-sub')