UNPKG

prepack

Version:

Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.

114 lines (87 loc) 2.96 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _index = require("./index.js"); var _invariant = require("../invariant.js"); var _invariant2 = _interopRequireDefault(_invariant); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } class ConcreteValue extends _index.Value { constructor(realm, intrinsicName) { (0, _invariant2.default)(realm, "realm required"); super(realm, intrinsicName); } 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, _invariant2.default)(false, "expected this to be a number if concrete"); } throwIfNotConcreteString() { (0, _invariant2.default)(false, "expected this to be a string if concrete"); } throwIfNotConcreteBoolean() { (0, _invariant2.default)(false, "expected this to be a boolean if concrete"); } throwIfNotConcreteSymbol() { (0, _invariant2.default)(false, "expected this to be a symbol if concrete"); } throwIfNotConcreteObject() { return this.throwIfNotObject(); } throwIfNotConcretePrimitive() { (0, _invariant2.default)(false, "expected this to be a primitive value if concrete"); } throwIfNotObject() { (0, _invariant2.default)(false, "expected this to be an object if concrete"); } } exports.default = ConcreteValue; /** * 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. */ //# sourceMappingURL=ConcreteValue.js.map