Fix #4840: Alias class prototype for methods in loose mode (#5560)

* Fix #4840: Alias class prototype for methods in loose mode

* Cleanup
This commit is contained in:
Oliver Don
2017-08-27 02:15:45 +01:00
committed by Justin Ridgewell
parent d8b4073536
commit 960151c876
10 changed files with 62 additions and 13 deletions

View File

@@ -5,7 +5,9 @@ let A = function A() {
let B = function () {
function B() {}
B.prototype.b = function b() {
var _proto = B.prototype;
_proto.b = function b() {
console.log('b');
};

View File

@@ -1,5 +1,7 @@
var x = function () {
x.prototype.f = function f() {
var _proto = x.prototype;
_proto.f = function f() {
1;
2;
3;

View File

@@ -1,7 +1,9 @@
var Foo = function () {
function Foo() {}
Foo.prototype["bar"] = function bar() {};
var _proto = Foo.prototype;
_proto["bar"] = function bar() {};
return Foo;
}();
}();

View File

@@ -2,9 +2,11 @@
var C = function () {
function C() {}
C.prototype.m = function m(x: number): string {
var _proto = C.prototype;
_proto.m = function m(x: number): string {
return 'a';
};
return C;
}();
}();

View File

@@ -0,0 +1,5 @@
class Test {
a() {}
static b() {}
c() {}
}

View File

@@ -0,0 +1,13 @@
var Test = function () {
function Test() {}
var _proto = Test.prototype;
_proto.a = function a() {};
Test.b = function b() {};
_proto.c = function c() {};
return Test;
}();

View File

@@ -3,11 +3,13 @@
var Example = function () {
function Example() {}
Example.prototype.test1 = async function test1() {
var _proto = Example.prototype;
_proto.test1 = async function test1() {
await Promise.resolve(2);
};
Example.prototype.test2 =
_proto.test2 =
/*#__PURE__*/
regeneratorRuntime.mark(function test2() {
return regeneratorRuntime.wrap(function test2$(_context) {