Fix incorrect value of _cache in _wrapNativeSuper (#7570)
The boolean expressions returns false in environments where Map is missing. This change explicitly sets _cache to undefined in such cases, to ensure the cache methods will be ignored.
This commit is contained in:
parent
91a114f74a
commit
07ab02f6b2
@ -455,7 +455,7 @@ helpers.wrapNativeSuper = () => template.program.ast`
|
||||
return _sPO(new Constructor, Class.prototype);
|
||||
};
|
||||
|
||||
var _cache = typeof Map === "function" && new Map();
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
export default function _wrapNativeSuper(Class) {
|
||||
if (typeof Class !== "function") {
|
||||
|
||||
@ -6,7 +6,7 @@ var _sPO = Object.setPrototypeOf || function _sPO(o, p) { o.__proto__ = p; retur
|
||||
|
||||
var _construct = typeof Reflect === "object" && Reflect.construct || function _construct(Parent, args, Class) { var Constructor, a = [null]; a.push.apply(a, args); Constructor = Parent.bind.apply(Parent, a); return _sPO(new Constructor(), Class.prototype); };
|
||||
|
||||
var _cache = typeof Map === "function" && new Map();
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
function _wrapNativeSuper(Class) { if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() {} Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _sPO(Wrapper, _sPO(function Super() { return _construct(Class, arguments, _gPO(this).constructor); }, Class)); }
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ var _sPO = Object.setPrototypeOf || function _sPO(o, p) { o.__proto__ = p; retur
|
||||
|
||||
var _construct = typeof Reflect === "object" && Reflect.construct || function _construct(Parent, args, Class) { var Constructor, a = [null]; a.push.apply(a, args); Constructor = Parent.bind.apply(Parent, a); return _sPO(new Constructor(), Class.prototype); };
|
||||
|
||||
var _cache = typeof Map === "function" && new Map();
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
function _wrapNativeSuper(Class) { if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() {} Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _sPO(Wrapper, _sPO(function Super() { return _construct(Class, arguments, _gPO(this).constructor); }, Class)); }
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ var _sPO = Object.setPrototypeOf || function _sPO(o, p) { o.__proto__ = p; retur
|
||||
|
||||
var _construct = (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && Reflect.construct || function _construct(Parent, args, Class) { var Constructor, a = [null]; a.push.apply(a, args); Constructor = Parent.bind.apply(Parent, a); return _sPO(new Constructor(), Class.prototype); };
|
||||
|
||||
var _cache = typeof Map === "function" && new Map();
|
||||
var _cache = typeof Map === "function" ? new Map() : undefined;
|
||||
|
||||
function _wrapNativeSuper(Class) { if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() {} Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _sPO(Wrapper, _sPO(function Super() { return _construct(Class, arguments, _gPO(this).constructor); }, Class)); }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user