1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
//// [super1.ts]
// Case 1
class Base1 {
public foo() {
return "base";
}
}
class Sub1 extends Base1 {
public bar() {
return "base";
}
}
class SubSub1 extends Sub1 {
public bar() {
return super.super.foo;
}
}
// Case 2
class Base2 {
public foo() {
return "base";
}
}
class SubE2 extends Base2 {
public bar() {
return super.prototype.foo = null;
}
}
// Case 3
class Base3 {
public foo() {
return "base";
}
}
class SubE3 extends Base3 {
public bar() {
return super.bar();
}
}
// Case 4
module Base4 {
class Sub4 {
public x(){
return "hello";
}
}
export class SubSub4 extends Sub4{
public x(){
return super.x();
}
}
export class Sub4E {
public x() {
return super.x();
}
}
}
//// [super1.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
// Case 1
var Base1 = (function () {
function Base1() {
}
Base1.prototype.foo = function () {
return "base";
};
return Base1;
}());
var Sub1 = (function (_super) {
__extends(Sub1, _super);
function Sub1() {
return _super !== null && _super.apply(this, arguments) || this;
}
Sub1.prototype.bar = function () {
return "base";
};
return Sub1;
}(Base1));
var SubSub1 = (function (_super) {
__extends(SubSub1, _super);
function SubSub1() {
return _super !== null && _super.apply(this, arguments) || this;
}
SubSub1.prototype.bar = function () {
return _super.prototype["super"].foo;
};
return SubSub1;
}(Sub1));
// Case 2
var Base2 = (function () {
function Base2() {
}
Base2.prototype.foo = function () {
return "base";
};
return Base2;
}());
var SubE2 = (function (_super) {
__extends(SubE2, _super);
function SubE2() {
return _super !== null && _super.apply(this, arguments) || this;
}
SubE2.prototype.bar = function () {
return _super.prototype.prototype.foo = null;
};
return SubE2;
}(Base2));
// Case 3
var Base3 = (function () {
function Base3() {
}
Base3.prototype.foo = function () {
return "base";
};
return Base3;
}());
var SubE3 = (function (_super) {
__extends(SubE3, _super);
function SubE3() {
return _super !== null && _super.apply(this, arguments) || this;
}
SubE3.prototype.bar = function () {
return _super.prototype.bar.call(this);
};
return SubE3;
}(Base3));
// Case 4
var Base4;
(function (Base4) {
var Sub4 = (function () {
function Sub4() {
}
Sub4.prototype.x = function () {
return "hello";
};
return Sub4;
}());
var SubSub4 = (function (_super) {
__extends(SubSub4, _super);
function SubSub4() {
return _super !== null && _super.apply(this, arguments) || this;
}
SubSub4.prototype.x = function () {
return _super.prototype.x.call(this);
};
return SubSub4;
}(Sub4));
Base4.SubSub4 = SubSub4;
var Sub4E = (function () {
function Sub4E() {
}
Sub4E.prototype.x = function () {
return _super.prototype.x.call(this);
};
return Sub4E;
}());
Base4.Sub4E = Sub4E;
})(Base4 || (Base4 = {}));
|