1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _index = require("./index.js");
|
9 |
|
10 | var _invariant = _interopRequireDefault(require("../invariant.js"));
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | class FunctionValue extends _index.ObjectValue {
|
25 | constructor(realm, intrinsicName) {
|
26 | super(realm, realm.intrinsics.FunctionPrototype, intrinsicName);
|
27 | }
|
28 |
|
29 | getName() {
|
30 | throw new Error("Abstract method");
|
31 | }
|
32 |
|
33 | getKind() {
|
34 | return "Function";
|
35 | }
|
36 |
|
37 | getLength() {
|
38 | let binding = this.properties.get("length");
|
39 | (0, _invariant.default)(binding);
|
40 | let desc = binding.descriptor;
|
41 | (0, _invariant.default)(desc);
|
42 | let value = desc.value;
|
43 | if (!(value instanceof _index.NumberValue)) return undefined;
|
44 | return value.value;
|
45 | }
|
46 |
|
47 | hasDefaultLength() {
|
48 | (0, _invariant.default)(false, "abstract method; please override");
|
49 | }
|
50 |
|
51 | getDebugName() {
|
52 | return super.getDebugName() || this.getName();
|
53 | }
|
54 |
|
55 | }
|
56 |
|
57 | exports.default = FunctionValue;
|
58 |
|
\ | No newline at end of file |