constructor.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. var RTL$ = {
  2. extend: function (cons, base){
  3. function Type(){}
  4. Type.prototype = base.prototype;
  5. cons.prototype = new Type();
  6. cons.prototype.constructor = cons;
  7. }
  8. };
  9. var m = function (){
  10. function DerivedRecordWithParamConstructorWithoutConstructor(){
  11. RecordWithParamConstructor.apply(this, arguments);
  12. }
  13. RTL$.extend(DerivedRecordWithParamConstructorWithoutConstructor, RecordWithParamConstructor);
  14. function MixAutoAndManualInitFields(){
  15. this.iAuto = 0;
  16. this.iManual = 123;
  17. this.$rAuto = new T();
  18. this.$rManual = new RecordWithParamConstructor(345);
  19. this.setManual = 8;
  20. this.stringAuto = '';
  21. }
  22. function UsingSelfInFieldsInit(){
  23. this.i1 = 123;
  24. this.i2 = this.i1;
  25. }
  26. function FieldInitAndBody(){
  27. this.i = 1;
  28. this.i = 2;
  29. }
  30. function T(){
  31. }
  32. function Derived(){
  33. T.call(this);
  34. }
  35. RTL$.extend(Derived, T);
  36. function RecordWithField(){
  37. this.i = 0;
  38. }
  39. function RecordWithFieldDerived(){
  40. T.call(this);
  41. }
  42. RTL$.extend(RecordWithFieldDerived, T);
  43. function passAsArgument(o/*T*/){
  44. }
  45. function RecordWithParamConstructor(a/*INTEGER*/){
  46. }
  47. function DerivedRecordWithParamConstructor(){
  48. RecordWithParamConstructor.call(this, 123);
  49. }
  50. RTL$.extend(DerivedRecordWithParamConstructor, RecordWithParamConstructor);
  51. function InitializeField(){
  52. this.i = 123;
  53. }
  54. function InitializeRecordField(){
  55. this.$r = new RecordWithParamConstructor(123);
  56. }
  57. function InitializeMangledField(){
  58. this.constructor$ = 123;
  59. this.prototype$ = true;
  60. }
  61. passAsArgument(new T());
  62. var r = new T();
  63. var i = new RecordWithField().i;
  64. var rParam = new RecordWithParamConstructor(123);
  65. var derived = new DerivedRecordWithParamConstructorWithoutConstructor(123);
  66. }();