UNPKG

1.26 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _index = require("./index.js");
9
10var _invariant = _interopRequireDefault(require("../invariant.js"));
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14/**
15 * Copyright (c) 2017-present, Facebook, Inc.
16 * All rights reserved.
17 *
18 * This source code is licensed under the BSD-style license found in the
19 * LICENSE file in the root directory of this source tree. An additional grant
20 * of patent rights can be found in the PATENTS file in the same directory.
21 */
22
23/* strict-local */
24
25/* Bound Function Exotic Objects */
26class BoundFunctionValue extends _index.FunctionValue {
27 constructor(realm, intrinsicName) {
28 super(realm, intrinsicName);
29 }
30
31 // Override.
32 getName() {
33 return "Bound";
34 }
35
36 hasDefaultLength() {
37 let f = this.$BoundTargetFunction;
38 if (!(f instanceof _index.FunctionValue) || !f.hasDefaultLength()) return false;
39 let fl = f.getLength();
40 (0, _invariant.default)(fl !== undefined);
41 return this.getLength() === Math.max(fl - this.$BoundArguments.length, 0);
42 }
43
44}
45
46exports.default = BoundFunctionValue;
47//# sourceMappingURL=BoundFunctionValue.js.map
\No newline at end of file