Fix optional method chaining in derived classes (#10694)

This commit is contained in:
Shriram Balaji
2019-11-12 21:58:40 +05:30
committed by Brian Ng
parent d9fd07929a
commit ecad667dda
6 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
"use strict";
class Base {
method() {
return 'Hello!';
}
}
class Derived extends Base {
method() {
return super.method?.()
}
}

View File

@@ -0,0 +1,3 @@
{
"plugins": [["proposal-optional-chaining", { "loose": true }]]
}

View File

@@ -0,0 +1,15 @@
"use strict";
class Base {
method() {
return 'Hello!';
}
}
class Derived extends Base {
method() {
return super.method == null ? void 0 : super.method();
}
}

View File

@@ -0,0 +1,12 @@
"use strict";
class Base {
method() {
return 'Hello!';
}
}
class Derived extends Base {
method() {
return super.method?.()
}
}

View File

@@ -0,0 +1,17 @@
"use strict";
class Base {
method() {
return 'Hello!';
}
}
class Derived extends Base {
method() {
var _super$method;
return (_super$method = super.method) === null || _super$method === void 0 ? void 0 : _super$method.call(this);
}
}