reverts d6b39bc89b
This commit is contained in:
21
test/fixtures/esnext/es6-classes/super-change-proto.js
vendored
Normal file
21
test/fixtures/esnext/es6-classes/super-change-proto.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var log = '';
|
||||
|
||||
class Base {
|
||||
p() { log += '[Base]'; }
|
||||
}
|
||||
|
||||
class OtherBase {
|
||||
p() { log += '[OtherBase]'; }
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
p() {
|
||||
log += '[Derived]';
|
||||
super.p();
|
||||
Derived.prototype.__proto__ = OtherBase.prototype;
|
||||
super.p();
|
||||
}
|
||||
}
|
||||
|
||||
new Derived().p();
|
||||
assert.equal(log, '[Derived][Base][OtherBase]');
|
||||
@@ -15,14 +15,14 @@ var Test = (function (Foo) {
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
woops["super"].test();
|
||||
_get(Foo.prototype, "constructor", this).call(this);
|
||||
_get(Foo.prototype, "test", this).call(this);
|
||||
_get(Object.getPrototypeOf(Test.prototype), "constructor", this).call(this);
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
|
||||
|
||||
_get(Foo.prototype, "constructor", this).apply(this, arguments);
|
||||
(_get2 = _get(Foo.prototype, "constructor", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
_get(Object.getPrototypeOf(Test.prototype), "constructor", this).apply(this, arguments);
|
||||
(_get2 = _get(Object.getPrototypeOf(Test.prototype), "constructor", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
|
||||
_get(Foo.prototype, "test", this).apply(this, arguments);
|
||||
(_get3 = _get(Foo.prototype, "test", this)).call.apply(_get3, [this, "test"].concat(_slice.call(arguments)));
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
|
||||
(_get3 = _get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_get3, [this, "test"].concat(_slice.call(arguments)));
|
||||
}
|
||||
|
||||
_inherits(Test, Foo);
|
||||
@@ -31,9 +31,9 @@ var Test = (function (Foo) {
|
||||
foo: {
|
||||
value: function foo() {
|
||||
var _get2;
|
||||
_get(Foo, "foo", this).call(this);
|
||||
_get(Foo, "foo", this).apply(this, arguments);
|
||||
(_get2 = _get(Foo, "foo", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
_get(Object.getPrototypeOf(Test), "foo", this).call(this);
|
||||
_get(Object.getPrototypeOf(Test), "foo", this).apply(this, arguments);
|
||||
(_get2 = _get(Object.getPrototypeOf(Test), "foo", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
@@ -42,9 +42,9 @@ var Test = (function (Foo) {
|
||||
test: {
|
||||
value: function test() {
|
||||
var _get2;
|
||||
_get(Foo.prototype, "test", this).call(this);
|
||||
_get(Foo.prototype, "test", this).apply(this, arguments);
|
||||
(_get2 = _get(Foo.prototype, "test", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
|
||||
(_get2 = _get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
|
||||
@@ -10,8 +10,8 @@ var Test = (function (Foo) {
|
||||
function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
_get(Foo.prototype, "test", this);
|
||||
_get(Foo.prototype, "test", this).whatever;
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this);
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this).whatever;
|
||||
}
|
||||
|
||||
_inherits(Test, Foo);
|
||||
|
||||
@@ -12,8 +12,8 @@ var Test = (function (Foo) {
|
||||
function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
_get(Foo.prototype, "test", this).whatever();
|
||||
_get(Foo.prototype, "test", this).call(this);
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this).whatever();
|
||||
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
|
||||
}
|
||||
|
||||
_inherits(Test, Foo);
|
||||
@@ -21,7 +21,7 @@ var Test = (function (Foo) {
|
||||
_prototypeProperties(Test, {
|
||||
test: {
|
||||
value: function test() {
|
||||
return _get(Foo, "wow", this).call(this);
|
||||
return _get(Object.getPrototypeOf(Test), "wow", this).call(this);
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
|
||||
21
test/fixtures/transformation/es6-classes/super-change-proto/exec.js
vendored
Normal file
21
test/fixtures/transformation/es6-classes/super-change-proto/exec.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var log = '';
|
||||
|
||||
class Base {
|
||||
p() { log += '[Base]'; }
|
||||
}
|
||||
|
||||
class OtherBase {
|
||||
p() { log += '[OtherBase]'; }
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
p() {
|
||||
log += '[Derived]';
|
||||
super.p();
|
||||
Derived.prototype.__proto__ = OtherBase.prototype;
|
||||
super.p();
|
||||
}
|
||||
}
|
||||
|
||||
new Derived().p();
|
||||
assert.equal(log, '[Derived][Base][OtherBase]');
|
||||
@@ -7,5 +7,5 @@ var _classCallCheck = function (instance, Constructor) { if (!(instance instance
|
||||
var Test = function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
_get(Function.prototype, "hasOwnProperty", this).call(this, "test");
|
||||
};
|
||||
_get(Object.getPrototypeOf(Test.prototype), "hasOwnProperty", this).call(this, "test");
|
||||
};
|
||||
Reference in New Issue
Block a user