UNPKG

1.22 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
10/**
11 * Copyright (c) 2017-present, Facebook, Inc.
12 * All rights reserved.
13 *
14 * This source code is licensed under the BSD-style license found in the
15 * LICENSE file in the root directory of this source tree. An additional grant
16 * of patent rights can be found in the PATENTS file in the same directory.
17 */
18
19/* strict-local */
20class BooleanValue extends _index.PrimitiveValue {
21 constructor(realm, value, intrinsicName) {
22 super(realm, intrinsicName);
23 this.value = value;
24 if (value && realm.intrinsics.true) return realm.intrinsics.true;
25 if (!value && realm.intrinsics.false) return realm.intrinsics.false;
26 }
27
28 equals(x) {
29 return x instanceof BooleanValue && this.value === x.value;
30 }
31
32 getHash() {
33 return this.value ? 12484058682847432 : 3777063795205331;
34 }
35
36 mightBeFalse() {
37 return !this.value;
38 }
39
40 throwIfNotConcreteBoolean() {
41 return this;
42 }
43
44 _serialize() {
45 return this.value;
46 }
47
48 toDisplayString() {
49 return this.value.toString();
50 }
51
52}
53
54exports.default = BooleanValue;
55//# sourceMappingURL=BooleanValue.js.map
\No newline at end of file