prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
47 lines (36 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _index = require("./index.js");
var _invariant = _interopRequireDefault(require("../invariant.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/* strict-local */
/* Bound Function Exotic Objects */
class BoundFunctionValue extends _index.FunctionValue {
constructor(realm, intrinsicName) {
super(realm, intrinsicName);
}
// Override.
getName() {
return "Bound";
}
hasDefaultLength() {
let f = this.$BoundTargetFunction;
if (!(f instanceof _index.FunctionValue) || !f.hasDefaultLength()) return false;
let fl = f.getLength();
(0, _invariant.default)(fl !== undefined);
return this.getLength() === Math.max(fl - this.$BoundArguments.length, 0);
}
}
exports.default = BoundFunctionValue;
//# sourceMappingURL=BoundFunctionValue.js.map