ecomfe / oo

Base library for OO style programming
MIT License
5 stars 5 forks source link

一个非oo框架实现继承的class,继承自一个oo框架定义的class,会出错 #10

Closed otakustay closed 10 years ago

otakustay commented 10 years ago

https://github.com/ecomfe/oo/blob/master/src/oo.js#L138

这里会无限递归,因为默认constructor指向自己

Exodia commented 10 years ago

fixed at https://github.com/ecomfe/oo/commit/e9abd2ad6bf4dac9a8f32191f5523f5926416c4c

Justineo commented 10 years ago

我这里的继承关系是 AdListModel --> ListModel --> BaseModel --> UIModel --> Model,最后还是无限递归了。判断 kclass.caller === this.constructor 的地方得到的是 BaseModel vs AdListModel,没进去,还是进了后面的 this.constructor.apply

Exodia commented 10 years ago

确实还有问题,kclass.caller === this.constructor 仅修复了一层的继承

Exodia commented 10 years ago

继续 fixed at https://github.com/ecomfe/oo/commit/b2adc83be4d2e60737eaf1b48fea8d35118dcfcc#diff-309cd9579346927242e4e3a135931e99R139

。。。