prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
122 lines (92 loc) • 2.78 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 */
class ConcreteValue extends _index.Value {
constructor(realm, intrinsicName) {
(0, _invariant.default)(realm, "realm required");
super(realm, intrinsicName);
}
isTemporal() {
return false;
}
mightNotBeFalse() {
return !this.mightBeFalse();
}
mightBeNull() {
return this instanceof _index.NullValue;
}
mightNotBeNull() {
return !(this instanceof _index.NullValue);
}
mightBeNumber() {
return this instanceof _index.NumberValue;
}
mightNotBeNumber() {
return !(this instanceof _index.NumberValue);
}
mightNotBeObject() {
return !(this instanceof _index.ObjectValue);
}
mightBeObject() {
return this instanceof _index.ObjectValue;
}
mightBeString() {
return this instanceof _index.StringValue;
}
mightNotBeString() {
return !(this instanceof _index.StringValue);
}
mightBeUndefined() {
return this instanceof _index.UndefinedValue;
}
mightNotBeUndefined() {
return !(this instanceof _index.UndefinedValue);
}
mightHaveBeenDeleted() {
return this instanceof _index.EmptyValue;
}
promoteEmptyToUndefined() {
if (this instanceof _index.EmptyValue) return this.$Realm.intrinsics.undefined;
return this;
}
throwIfNotConcrete() {
return this;
}
throwIfNotConcreteNumber() {
(0, _invariant.default)(false, "expected this to be a number if concrete");
}
throwIfNotConcreteString() {
(0, _invariant.default)(false, "expected this to be a string if concrete");
}
throwIfNotConcreteBoolean() {
(0, _invariant.default)(false, "expected this to be a boolean if concrete");
}
throwIfNotConcreteSymbol() {
(0, _invariant.default)(false, "expected this to be a symbol if concrete");
}
throwIfNotConcreteObject() {
return this.throwIfNotObject();
}
throwIfNotConcretePrimitive() {
(0, _invariant.default)(false, "expected this to be a primitive value if concrete");
}
throwIfNotObject() {
(0, _invariant.default)(false, "expected this to be an object if concrete");
}
}
exports.default = ConcreteValue;
//# sourceMappingURL=ConcreteValue.js.map