record.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. var RTL$ = {
  2. extend: function extend(methods){
  3. function Type(){
  4. for(var m in methods)
  5. this[m] = methods[m];
  6. }
  7. Type.prototype = this.prototype;
  8. var result = methods.init;
  9. result.prototype = new Type(); // inherit this.prototype
  10. result.prototype.constructor = result; // to see constructor name in diagnostic
  11. result.extend = extend;
  12. return result;
  13. },
  14. copy: function (from, to){
  15. for(var prop in to){
  16. if (to.hasOwnProperty(prop)){
  17. var v = from[prop];
  18. if (v !== null && typeof v == "object")
  19. this.copy(v, to[prop]);
  20. else
  21. to[prop] = v;
  22. }
  23. }
  24. }
  25. };
  26. var m = function (){
  27. var Base1 = RTL$.extend({
  28. init: function Base1(){
  29. }
  30. });
  31. var T1 = Base1.extend({
  32. init: function T1(){
  33. Base1.prototype.init.call(this);
  34. }
  35. });
  36. var b1 = new Base1();
  37. var r1 = new T1();
  38. function p1(r/*T1*/){
  39. }
  40. function p2(r/*VAR T1*/){
  41. p1(r);
  42. }
  43. RTL$.copy(r1, b1);
  44. p1(r1);
  45. p2(r1);
  46. }();