Speed up the createSuper helper (#11401)

This commit is contained in:
Justin Ridgewell
2020-04-10 10:00:20 -04:00
committed by GitHub
parent 88b12e3dd1
commit 070ec201bb
46 changed files with 48 additions and 46 deletions

View File

@@ -742,9 +742,11 @@ helpers.createSuper = helper("7.9.0")`
import possibleConstructorReturn from "possibleConstructorReturn";
export default function _createSuper(Derived) {
var hasNativeReflectConstruct = isNativeReflectConstruct();
return function () {
var Super = getPrototypeOf(Derived), result;
if (isNativeReflectConstruct()) {
if (hasNativeReflectConstruct) {
// NOTE: This doesn't work if this.__proto__.constructor has been modified.
var NewTarget = getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);