Fix optional method chaining in derived classes (#10694)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
class Base {
|
||||
method() {
|
||||
return 'Hello!';
|
||||
}
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
method() {
|
||||
return super.method?.()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["proposal-optional-chaining", { "loose": true }]]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
class Base {
|
||||
method() {
|
||||
return 'Hello!';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
method() {
|
||||
return super.method == null ? void 0 : super.method();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
class Base {
|
||||
method() {
|
||||
return 'Hello!';
|
||||
}
|
||||
}
|
||||
|
||||
class Derived extends Base {
|
||||
method() {
|
||||
return super.method?.()
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user