SwVitaliy

Untitled

Apr 29th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function T(){ this.all.push(this) }
  2. >undefined
  3. T.prototype.all =[];
  4. >[]
  5. Utils.extend
  6. >function extend(Child, Parent)
  7. {
  8. var F = function() { };
  9. F.prototype = Parent.prototype;
  10. Child.prototype = new F();
  11. Child.prototype.constructor = Child;
  12. Child.superclass = Parent.prototype;
  13. }
  14.  
  15. function T1() { arguments.callee.superclass.constructor.apply(this, []) }
  16. >undefined
  17. Utils.extend(T1, T);
  18. >undefined
  19. new T1
  20. >T1
  21. new T1
  22. >T1
  23. T.prototype.all
  24. >[
  25. T1
  26. ,
  27. T1
  28. ]
  29. function T2() { console.log(arguments.callee.superclass.constructor) }
  30. >undefined
  31. Utils.extend(T2, T1);
  32. >undefined
  33. new T2
  34. >function T1() { arguments.callee.superclass.constructor.apply(this, []) }
  35. >T2
  36. function T2() { arguments.callee.superclass.constructor.apply(this, []) }
  37. >undefined
  38. Utils.extend(T2, T1);
  39. >undefined
  40. new T2
  41. >T2
  42. T.prototype.all
  43. >[
  44. T1
  45. ,
  46. T1
  47. ,
  48. T2
  49. ]
Advertisement
Add Comment
Please, Sign In to add comment