152 lines
9.0 KiB
JavaScript
152 lines
9.0 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _index = require("./index.js");
|
|
|
|
var _invariant = require("../invariant.js");
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
|
|
* 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.
|
|
*/
|
|
|
|
var ConcreteValue = function (_Value) {
|
|
_inherits(ConcreteValue, _Value);
|
|
|
|
function ConcreteValue(realm, intrinsicName) {
|
|
_classCallCheck(this, ConcreteValue);
|
|
|
|
(0, _invariant2.default)(realm, "realm required");
|
|
return _possibleConstructorReturn(this, (ConcreteValue.__proto__ || Object.getPrototypeOf(ConcreteValue)).call(this, realm, intrinsicName));
|
|
}
|
|
|
|
_createClass(ConcreteValue, [{
|
|
key: "mightNotBeFalse",
|
|
value: function mightNotBeFalse() {
|
|
return !this.mightBeFalse();
|
|
}
|
|
}, {
|
|
key: "mightBeNull",
|
|
value: function mightBeNull() {
|
|
return this instanceof _index.NullValue;
|
|
}
|
|
}, {
|
|
key: "mightNotBeNull",
|
|
value: function mightNotBeNull() {
|
|
return !(this instanceof _index.NullValue);
|
|
}
|
|
}, {
|
|
key: "mightBeNumber",
|
|
value: function mightBeNumber() {
|
|
return this instanceof _index.NumberValue;
|
|
}
|
|
}, {
|
|
key: "mightNotBeNumber",
|
|
value: function mightNotBeNumber() {
|
|
return !(this instanceof _index.NumberValue);
|
|
}
|
|
}, {
|
|
key: "mightNotBeObject",
|
|
value: function mightNotBeObject() {
|
|
return !(this instanceof _index.ObjectValue);
|
|
}
|
|
}, {
|
|
key: "mightBeObject",
|
|
value: function mightBeObject() {
|
|
return this instanceof _index.ObjectValue;
|
|
}
|
|
}, {
|
|
key: "mightBeString",
|
|
value: function mightBeString() {
|
|
return this instanceof _index.StringValue;
|
|
}
|
|
}, {
|
|
key: "mightNotBeString",
|
|
value: function mightNotBeString() {
|
|
return !(this instanceof _index.StringValue);
|
|
}
|
|
}, {
|
|
key: "mightBeUndefined",
|
|
value: function mightBeUndefined() {
|
|
return this instanceof _index.UndefinedValue;
|
|
}
|
|
}, {
|
|
key: "mightNotBeUndefined",
|
|
value: function mightNotBeUndefined() {
|
|
return !(this instanceof _index.UndefinedValue);
|
|
}
|
|
}, {
|
|
key: "mightHaveBeenDeleted",
|
|
value: function mightHaveBeenDeleted() {
|
|
return this instanceof _index.EmptyValue;
|
|
}
|
|
}, {
|
|
key: "promoteEmptyToUndefined",
|
|
value: function promoteEmptyToUndefined() {
|
|
if (this instanceof _index.EmptyValue) return this.$Realm.intrinsics.undefined;
|
|
return this;
|
|
}
|
|
}, {
|
|
key: "throwIfNotConcrete",
|
|
value: function throwIfNotConcrete() {
|
|
return this;
|
|
}
|
|
}, {
|
|
key: "throwIfNotConcreteNumber",
|
|
value: function throwIfNotConcreteNumber() {
|
|
(0, _invariant2.default)(false, "expected this to be a number if concrete");
|
|
}
|
|
}, {
|
|
key: "throwIfNotConcreteString",
|
|
value: function throwIfNotConcreteString() {
|
|
(0, _invariant2.default)(false, "expected this to be a string if concrete");
|
|
}
|
|
}, {
|
|
key: "throwIfNotConcreteBoolean",
|
|
value: function throwIfNotConcreteBoolean() {
|
|
(0, _invariant2.default)(false, "expected this to be a boolean if concrete");
|
|
}
|
|
}, {
|
|
key: "throwIfNotConcreteSymbol",
|
|
value: function throwIfNotConcreteSymbol() {
|
|
(0, _invariant2.default)(false, "expected this to be a symbol if concrete");
|
|
}
|
|
}, {
|
|
key: "throwIfNotConcreteObject",
|
|
value: function throwIfNotConcreteObject() {
|
|
return this.throwIfNotObject();
|
|
}
|
|
}, {
|
|
key: "throwIfNotConcretePrimitive",
|
|
value: function throwIfNotConcretePrimitive() {
|
|
(0, _invariant2.default)(false, "expected this to be a primitive value if concrete");
|
|
}
|
|
}, {
|
|
key: "throwIfNotObject",
|
|
value: function throwIfNotObject() {
|
|
(0, _invariant2.default)(false, "expected this to be an object if concrete");
|
|
}
|
|
}]);
|
|
|
|
return ConcreteValue;
|
|
}(_index.Value);
|
|
|
|
exports.default = ConcreteValue;
|
|
//# sourceMappingURL=ConcreteValue.js.map
|