first commit
This commit is contained in:
1110
build/node_modules/prepack/lib/values/AbstractObjectValue.js
generated
vendored
Normal file
1110
build/node_modules/prepack/lib/values/AbstractObjectValue.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
build/node_modules/prepack/lib/values/AbstractObjectValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/AbstractObjectValue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
812
build/node_modules/prepack/lib/values/AbstractValue.js
generated
vendored
Normal file
812
build/node_modules/prepack/lib/values/AbstractValue.js
generated
vendored
Normal file
@@ -0,0 +1,812 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
||||
|
||||
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 _errors = require("../errors.js");
|
||||
|
||||
var _generator = require("../utils/generator.js");
|
||||
|
||||
var _index = require("./index.js");
|
||||
|
||||
var _index2 = require("../methods/index.js");
|
||||
|
||||
var _index3 = require("../domains/index.js");
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||||
|
||||
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 AbstractValue = function (_Value) {
|
||||
_inherits(AbstractValue, _Value);
|
||||
|
||||
function AbstractValue(realm, types, values, hashValue, args, buildNode, optionalArgs) {
|
||||
_classCallCheck(this, AbstractValue);
|
||||
|
||||
(0, _invariant2.default)(realm.useAbstractInterpretation);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (AbstractValue.__proto__ || Object.getPrototypeOf(AbstractValue)).call(this, realm, optionalArgs ? optionalArgs.intrinsicName : undefined));
|
||||
|
||||
(0, _invariant2.default)(buildNode instanceof Function || args.length === 0);
|
||||
(0, _invariant2.default)(!_index.Value.isTypeCompatibleWith(types.getType(), _index.ObjectValue) || _this instanceof _index.AbstractObjectValue);
|
||||
(0, _invariant2.default)(types.getType() !== _index.NullValue && types.getType() !== _index.UndefinedValue);
|
||||
_this.types = types;
|
||||
_this.values = values;
|
||||
_this.mightBeEmpty = false;
|
||||
_this._buildNode = buildNode;
|
||||
_this.args = args;
|
||||
_this.hashValue = hashValue;
|
||||
_this.kind = optionalArgs ? optionalArgs.kind : undefined;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(AbstractValue, [{
|
||||
key: "addSourceLocationsTo",
|
||||
value: function addSourceLocationsTo(locations) {
|
||||
var seenValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
|
||||
|
||||
if (seenValues.has(this)) return;
|
||||
seenValues.add(this);
|
||||
if (this._buildNode && !(this._buildNode instanceof Function)) {
|
||||
if (this._buildNode.loc) locations.push(this._buildNode.loc);
|
||||
}
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = this.args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var val = _step.value;
|
||||
|
||||
if (val instanceof AbstractValue) val.addSourceLocationsTo(locations, seenValues);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "addSourceNamesTo",
|
||||
value: function addSourceNamesTo(names) {
|
||||
var gen = this.$Realm.preludeGenerator;
|
||||
function add_intrinsic(name) {
|
||||
if (name.startsWith("_$")) {
|
||||
if (gen === undefined) return;
|
||||
add_args(gen.derivedIds.get(name));
|
||||
} else if (names.indexOf(name) < 0) {
|
||||
names.push(name);
|
||||
}
|
||||
}
|
||||
function add_args(args) {
|
||||
if (args === undefined) return;
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = args[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var val = _step2.value;
|
||||
|
||||
if (val.intrinsicName) {
|
||||
add_intrinsic(val.intrinsicName);
|
||||
} else if (val instanceof AbstractValue) {
|
||||
val.addSourceNamesTo(names);
|
||||
} else if (val instanceof _index.StringValue) {
|
||||
if (val.value.startsWith("__")) {
|
||||
names.push(val.value.slice(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.intrinsicName) {
|
||||
add_intrinsic(this.intrinsicName);
|
||||
}
|
||||
add_args(this.args);
|
||||
}
|
||||
}, {
|
||||
key: "buildNode",
|
||||
value: function buildNode(args) {
|
||||
var buildNode = this.getBuildNode();
|
||||
return buildNode instanceof Function ? buildNode(args) : buildNode;
|
||||
}
|
||||
}, {
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
if (x instanceof _index.ConcreteValue) return false;
|
||||
var thisArgs = this.args;
|
||||
var n = thisArgs.length;
|
||||
|
||||
var argsAreEqual = function argsAreEqual() {
|
||||
(0, _invariant2.default)(x instanceof AbstractValue);
|
||||
var xArgs = x.args;
|
||||
var m = xArgs.length;
|
||||
(0, _invariant2.default)(n === m); // Will be true if kinds are the same. Caller should see to it.
|
||||
for (var i = 0; i < n; i++) {
|
||||
var a = thisArgs[i];
|
||||
var b = xArgs[i];
|
||||
if (!a.equals(b)) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
return this === x || x instanceof AbstractValue && this.kind === x.kind && this.hashValue === x.hashValue && (this.intrinsicName && this.intrinsicName.length > 0 && this.intrinsicName === x.intrinsicName || n > 0 && argsAreEqual());
|
||||
}
|
||||
}, {
|
||||
key: "getBuildNode",
|
||||
value: function getBuildNode() {
|
||||
(0, _invariant2.default)(this._buildNode);
|
||||
return this._buildNode;
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
return this.hashValue;
|
||||
}
|
||||
}, {
|
||||
key: "getType",
|
||||
value: function getType() {
|
||||
return this.types.getType();
|
||||
}
|
||||
}, {
|
||||
key: "getIdentifier",
|
||||
value: function getIdentifier() {
|
||||
(0, _invariant2.default)(this.hasIdentifier());
|
||||
return this._buildNode;
|
||||
}
|
||||
}, {
|
||||
key: "hasIdentifier",
|
||||
value: function hasIdentifier() {
|
||||
return this._buildNode && this._buildNode.type === "Identifier";
|
||||
}
|
||||
|
||||
// this => val. A false value does not imply that !(this => val).
|
||||
|
||||
}, {
|
||||
key: "implies",
|
||||
value: function implies(val) {
|
||||
if (this.equals(val)) return true; // x => x regardless of its value
|
||||
if (!this.mightNotBeFalse()) return true; // false => val
|
||||
if (!val.mightNotBeTrue()) return true; // x => true regardless of the value of x
|
||||
if (val instanceof AbstractValue) {
|
||||
// Neither this (x) nor val (y) is a known value, so we need to do some reasoning based on the structure
|
||||
// x => !y if y => !x
|
||||
if (val.kind === "!") {
|
||||
var _val$args = _slicedToArray(val.args, 1),
|
||||
y = _val$args[0];
|
||||
|
||||
(0, _invariant2.default)(y instanceof AbstractValue);
|
||||
return y.impliesNot(this);
|
||||
}
|
||||
// x => x !== null && x !== undefined
|
||||
if (val.kind === "!==") {
|
||||
var _val$args2 = _slicedToArray(val.args, 2),
|
||||
x = _val$args2[0],
|
||||
_y = _val$args2[1];
|
||||
|
||||
if (this.implies(x)) return _y instanceof _index.NullValue || _y instanceof _index.UndefinedValue;
|
||||
if (this.implies(_y)) return x instanceof _index.NullValue || x instanceof _index.UndefinedValue;
|
||||
}
|
||||
// !!x => x
|
||||
if (this.kind === "!") {
|
||||
var _args = _slicedToArray(this.args, 1),
|
||||
nx = _args[0];
|
||||
|
||||
(0, _invariant2.default)(nx instanceof AbstractValue);
|
||||
if (nx.kind === "!") {
|
||||
var _nx$args = _slicedToArray(nx.args, 1),
|
||||
_x2 = _nx$args[0];
|
||||
|
||||
(0, _invariant2.default)(_x2 instanceof AbstractValue);
|
||||
return _x2.equals(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// this => !val. A false value does not imply that !(this => !val).
|
||||
|
||||
}, {
|
||||
key: "impliesNot",
|
||||
value: function impliesNot(val) {
|
||||
if (this.equals(val)) return false; // x => x regardless of its value, hence x => !val is false
|
||||
if (!this.mightNotBeFalse()) return true; // false => !val
|
||||
if (!val.mightNotBeFalse()) return true; // x => !false regardless of the value of x
|
||||
if (val instanceof AbstractValue) {
|
||||
// !x => !y if y => x
|
||||
if (this.kind === "!") {
|
||||
var _args2 = _slicedToArray(this.args, 1),
|
||||
x = _args2[0];
|
||||
|
||||
return val.implies(x);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// todo: abstract values should never be of type UndefinedValue or NullValue, assert this
|
||||
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.UndefinedValue) return true;
|
||||
if (valueType === _index.NullValue) return true;
|
||||
if (valueType === _index.SymbolValue) return false;
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.ObjectValue)) return false;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.mightBeFalse();
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeFalse",
|
||||
value: function mightNotBeFalse() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.UndefinedValue) return false;
|
||||
if (valueType === _index.NullValue) return false;
|
||||
if (valueType === _index.SymbolValue) return true;
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.ObjectValue)) return true;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.mightNotBeFalse();
|
||||
}
|
||||
}, {
|
||||
key: "mightBeNull",
|
||||
value: function mightBeNull() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.NullValue) return true;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return false;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueOfType(_index.NullValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeNull",
|
||||
value: function mightNotBeNull() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.NullValue) return false;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return true;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueNotOfType(_index.NullValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightBeNumber",
|
||||
value: function mightBeNumber() {
|
||||
var valueType = this.getType();
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.NumberValue)) return true;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return false;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueOfType(_index.NumberValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeNumber",
|
||||
value: function mightNotBeNumber() {
|
||||
var valueType = this.getType();
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.NumberValue)) return false;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return true;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueNotOfType(_index.NumberValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeObject",
|
||||
value: function mightNotBeObject() {
|
||||
var valueType = this.getType();
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.PrimitiveValue)) return true;
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.ObjectValue)) return false;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueNotOfType(_index.ObjectValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightBeObject",
|
||||
value: function mightBeObject() {
|
||||
var valueType = this.getType();
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.PrimitiveValue)) return false;
|
||||
if (_index.Value.isTypeCompatibleWith(valueType, _index.ObjectValue)) return true;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueOfType(_index.ObjectValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightBeString",
|
||||
value: function mightBeString() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.StringValue) return true;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return false;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueOfType(_index.StringValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeString",
|
||||
value: function mightNotBeString() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.StringValue) return false;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return true;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueNotOfType(_index.StringValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightBeUndefined",
|
||||
value: function mightBeUndefined() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.UndefinedValue) return true;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return false;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueOfType(_index.UndefinedValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeUndefined",
|
||||
value: function mightNotBeUndefined() {
|
||||
var valueType = this.getType();
|
||||
if (valueType === _index.UndefinedValue) return false;
|
||||
if (valueType !== _index.PrimitiveValue && valueType !== _index.Value) return true;
|
||||
if (this.values.isTop()) return true;
|
||||
return this.values.includesValueNotOfType(_index.UndefinedValue);
|
||||
}
|
||||
}, {
|
||||
key: "mightHaveBeenDeleted",
|
||||
value: function mightHaveBeenDeleted() {
|
||||
return this.mightBeEmpty;
|
||||
}
|
||||
}, {
|
||||
key: "promoteEmptyToUndefined",
|
||||
value: function promoteEmptyToUndefined() {
|
||||
if (this.values.isTop()) return this;
|
||||
if (!this.mightBeEmpty) return this;
|
||||
var cond = AbstractValue.createFromBinaryOp(this.$Realm, "===", this, this.$Realm.intrinsics.empty);
|
||||
var result = AbstractValue.createFromConditionalOp(this.$Realm, cond, this.$Realm.intrinsics.undefined, this);
|
||||
if (result instanceof AbstractValue) result.values = this.values.promoteEmptyToUndefined();
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcrete",
|
||||
value: function throwIfNotConcrete() {
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteNumber",
|
||||
value: function throwIfNotConcreteNumber() {
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteString",
|
||||
value: function throwIfNotConcreteString() {
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteBoolean",
|
||||
value: function throwIfNotConcreteBoolean() {
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteSymbol",
|
||||
value: function throwIfNotConcreteSymbol() {
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteObject",
|
||||
value: function throwIfNotConcreteObject() {
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcretePrimitive",
|
||||
value: function throwIfNotConcretePrimitive() {
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotObject",
|
||||
value: function throwIfNotObject() {
|
||||
(0, _invariant2.default)(!(this instanceof _index.AbstractObjectValue));
|
||||
AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
}], [{
|
||||
key: "createFromBinaryOp",
|
||||
value: function createFromBinaryOp(realm, op, left, right, loc, kind) {
|
||||
var leftTypes = void 0,
|
||||
leftValues = void 0;
|
||||
if (left instanceof AbstractValue) {
|
||||
leftTypes = left.types;
|
||||
leftValues = left.values;
|
||||
} else {
|
||||
leftTypes = new _index3.TypesDomain(left.getType());
|
||||
(0, _invariant2.default)(left instanceof _index.ConcreteValue);
|
||||
leftValues = new _index3.ValuesDomain(left);
|
||||
}
|
||||
|
||||
var rightTypes = void 0,
|
||||
rightValues = void 0;
|
||||
if (right instanceof AbstractValue) {
|
||||
rightTypes = right.types;
|
||||
rightValues = right.values;
|
||||
} else {
|
||||
rightTypes = new _index3.TypesDomain(right.getType());
|
||||
(0, _invariant2.default)(right instanceof _index.ConcreteValue);
|
||||
rightValues = new _index3.ValuesDomain(right);
|
||||
}
|
||||
|
||||
var resultTypes = _index3.TypesDomain.binaryOp(op, leftTypes, rightTypes);
|
||||
var resultValues = kind === "template for property name condition" ? _index3.ValuesDomain.topVal : _index3.ValuesDomain.binaryOp(realm, op, leftValues, rightValues);
|
||||
|
||||
var _ref = kind === undefined ? (0, _index2.hashBinary)(op, left, right) : (0, _index2.hashCall)(kind, left, right),
|
||||
_ref2 = _slicedToArray(_ref, 2),
|
||||
hash = _ref2[0],
|
||||
args = _ref2[1];
|
||||
|
||||
var result = new AbstractValue(realm, resultTypes, resultValues, hash, args, function (_ref3) {
|
||||
var _ref4 = _slicedToArray(_ref3, 2),
|
||||
x = _ref4[0],
|
||||
y = _ref4[1];
|
||||
|
||||
return t.binaryExpression(op, x, y);
|
||||
});
|
||||
result.kind = kind || op;
|
||||
result.expressionLocation = loc;
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "createFromLogicalOp",
|
||||
value: function createFromLogicalOp(realm, op, left, right, loc) {
|
||||
var leftTypes = void 0,
|
||||
leftValues = void 0;
|
||||
if (left instanceof AbstractValue) {
|
||||
leftTypes = left.types;
|
||||
leftValues = left.values;
|
||||
} else {
|
||||
leftTypes = new _index3.TypesDomain(left.getType());
|
||||
(0, _invariant2.default)(left instanceof _index.ConcreteValue);
|
||||
leftValues = new _index3.ValuesDomain(left);
|
||||
}
|
||||
|
||||
var rightTypes = void 0,
|
||||
rightValues = void 0;
|
||||
if (right instanceof AbstractValue) {
|
||||
rightTypes = right.types;
|
||||
rightValues = right.values;
|
||||
} else {
|
||||
rightTypes = new _index3.TypesDomain(right.getType());
|
||||
(0, _invariant2.default)(right instanceof _index.ConcreteValue);
|
||||
rightValues = new _index3.ValuesDomain(right);
|
||||
}
|
||||
|
||||
var resultTypes = _index3.TypesDomain.logicalOp(op, leftTypes, rightTypes);
|
||||
var resultValues = _index3.ValuesDomain.logicalOp(realm, op, leftValues, rightValues);
|
||||
|
||||
var _hashCall = (0, _index2.hashCall)(op, left, right),
|
||||
_hashCall2 = _slicedToArray(_hashCall, 2),
|
||||
hash = _hashCall2[0],
|
||||
args = _hashCall2[1];
|
||||
|
||||
var Constructor = _index.Value.isTypeCompatibleWith(resultTypes.getType(), _index.ObjectValue) ? _index.AbstractObjectValue : AbstractValue;
|
||||
var result = new Constructor(realm, resultTypes, resultValues, hash, args, function (_ref5) {
|
||||
var _ref6 = _slicedToArray(_ref5, 2),
|
||||
x = _ref6[0],
|
||||
y = _ref6[1];
|
||||
|
||||
return t.logicalExpression(op, x, y);
|
||||
});
|
||||
result.kind = op;
|
||||
result.expressionLocation = loc;
|
||||
return realm.simplifyAndRefineAbstractValue(result);
|
||||
}
|
||||
}, {
|
||||
key: "createFromConditionalOp",
|
||||
value: function createFromConditionalOp(realm, condition, left, right, loc) {
|
||||
var types = _index3.TypesDomain.joinValues(left, right);
|
||||
if (types.getType() === _index.NullValue) return realm.intrinsics.null;
|
||||
if (types.getType() === _index.UndefinedValue) return realm.intrinsics.undefined;
|
||||
var values = _index3.ValuesDomain.joinValues(realm, left, right);
|
||||
|
||||
var _hashTernary = (0, _index2.hashTernary)(condition, left || realm.intrinsics.undefined, right || realm.intrinsics.undefined),
|
||||
_hashTernary2 = _slicedToArray(_hashTernary, 2),
|
||||
hash = _hashTernary2[0],
|
||||
args = _hashTernary2[1];
|
||||
|
||||
var Constructor = _index.Value.isTypeCompatibleWith(types.getType(), _index.ObjectValue) ? _index.AbstractObjectValue : AbstractValue;
|
||||
var result = new Constructor(realm, types, values, hash, args, function (_ref7) {
|
||||
var _ref8 = _slicedToArray(_ref7, 3),
|
||||
c = _ref8[0],
|
||||
x = _ref8[1],
|
||||
y = _ref8[2];
|
||||
|
||||
return t.conditionalExpression(c, x, y);
|
||||
}, {
|
||||
kind: "conditional"
|
||||
});
|
||||
result.expressionLocation = loc;
|
||||
if (left) result.mightBeEmpty = left.mightHaveBeenDeleted();
|
||||
if (right && !result.mightBeEmpty) result.mightBeEmpty = right.mightHaveBeenDeleted();
|
||||
if (result.mightBeEmpty) return result;
|
||||
return realm.simplifyAndRefineAbstractValue(result);
|
||||
}
|
||||
}, {
|
||||
key: "createFromUnaryOp",
|
||||
value: function createFromUnaryOp(realm, op, operand, prefix, loc) {
|
||||
var resultTypes = _index3.TypesDomain.unaryOp(op);
|
||||
var resultValues = _index3.ValuesDomain.unaryOp(realm, op, operand.values);
|
||||
var result = new AbstractValue(realm, resultTypes, resultValues, (0, _index2.hashUnary)(op, operand), [operand], function (_ref9) {
|
||||
var _ref10 = _slicedToArray(_ref9, 1),
|
||||
x = _ref10[0];
|
||||
|
||||
return t.unaryExpression(op, x, prefix);
|
||||
});
|
||||
result.kind = op;
|
||||
result.expressionLocation = loc;
|
||||
return realm.simplifyAndRefineAbstractValue(result);
|
||||
}
|
||||
|
||||
/* Note that the template is parameterized by the names A, B, C and so on.
|
||||
When the abstract value is serialized, the serialized operations are substituted
|
||||
for the corresponding parameters and the resulting template is parsed into an AST subtree
|
||||
that is incorporated into the AST produced by the serializer. */
|
||||
|
||||
}, {
|
||||
key: "createFromTemplate",
|
||||
value: function createFromTemplate(realm, template, resultType, operands, kind, loc) {
|
||||
var resultTypes = new _index3.TypesDomain(resultType);
|
||||
var resultValues = _index3.ValuesDomain.topVal;
|
||||
var hash = void 0;
|
||||
|
||||
var _hashCall3 = _index2.hashCall.apply(undefined, [kind].concat(_toConsumableArray(operands)));
|
||||
|
||||
var _hashCall4 = _slicedToArray(_hashCall3, 2);
|
||||
|
||||
hash = _hashCall4[0];
|
||||
operands = _hashCall4[1];
|
||||
|
||||
var Constructor = _index.Value.isTypeCompatibleWith(resultType, _index.ObjectValue) ? _index.AbstractObjectValue : AbstractValue;
|
||||
var labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
(0, _invariant2.default)(labels.length >= operands.length);
|
||||
var result = new Constructor(realm, resultTypes, resultValues, hash, operands, function (args) {
|
||||
(0, _invariant2.default)(realm.preludeGenerator !== undefined);
|
||||
var generatorArgs = {};
|
||||
var i = 0;
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = args[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var arg = _step3.value;
|
||||
generatorArgs[labels.charAt(i++)] = arg;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return template(realm.preludeGenerator)(generatorArgs);
|
||||
});
|
||||
result.kind = kind;
|
||||
result.expressionLocation = loc || realm.currentLocation;
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "createFromType",
|
||||
value: function createFromType(realm, resultType, kind) {
|
||||
var types = new _index3.TypesDomain(resultType);
|
||||
var Constructor = _index.Value.isTypeCompatibleWith(resultType, _index.ObjectValue) ? _index.AbstractObjectValue : AbstractValue;
|
||||
var hash = (0, _index2.hashString)(resultType.name + (kind || ""));
|
||||
var result = new Constructor(realm, types, _index3.ValuesDomain.topVal, hash, []);
|
||||
if (kind) result.kind = kind;
|
||||
result.expressionLocation = realm.currentLocation;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Emits a declaration for an identifier into the generator at the current point in time
|
||||
and initializes it with an expression constructed from the given template.
|
||||
Returns an abstract value that refers to the newly declared identifier.
|
||||
Note that the template must generate an expression which has no side-effects
|
||||
on the prepack state. It is assumed, however, that there could be side-effects
|
||||
on the native state unless the isPure option is specified. */
|
||||
|
||||
}, {
|
||||
key: "createTemporalFromTemplate",
|
||||
value: function createTemporalFromTemplate(realm, template, resultType, operands, optionalArgs) {
|
||||
(0, _invariant2.default)(resultType !== _index.UndefinedValue);
|
||||
var temp = AbstractValue.createFromTemplate(realm, template, resultType, operands, "");
|
||||
var types = temp.types;
|
||||
var values = temp.values;
|
||||
var args = temp.args;
|
||||
var buildNode_ = temp.getBuildNode();
|
||||
(0, _invariant2.default)(realm.generator !== undefined);
|
||||
return realm.generator.derive(types, values, args, buildNode_, optionalArgs);
|
||||
}
|
||||
}, {
|
||||
key: "createTemporalFromBuildFunction",
|
||||
value: function createTemporalFromBuildFunction(realm, resultType, args, buildFunction, optionalArgs) {
|
||||
var types = new _index3.TypesDomain(resultType);
|
||||
var values = _index3.ValuesDomain.topVal;
|
||||
(0, _invariant2.default)(realm.generator !== undefined);
|
||||
if (resultType === _index.UndefinedValue) {
|
||||
return realm.generator.emitVoidExpression(types, values, args, buildFunction);
|
||||
} else {
|
||||
return realm.generator.derive(types, values, args, buildFunction, optionalArgs);
|
||||
}
|
||||
}
|
||||
|
||||
// Creates a union of an abstract value with one or more concrete values.
|
||||
// The build node for the abstract values becomes the build node for the union.
|
||||
// Use this only to allow instrinsic abstract objects to be null and/or undefined.
|
||||
|
||||
}, {
|
||||
key: "createAbstractConcreteUnion",
|
||||
value: function createAbstractConcreteUnion(realm) {
|
||||
for (var _len = arguments.length, elements = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
elements[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
var concreteValues = elements.filter(function (e) {
|
||||
return e instanceof _index.ConcreteValue;
|
||||
});
|
||||
(0, _invariant2.default)(concreteValues.length > 0 && concreteValues.length === elements.length - 1);
|
||||
var concreteSet = new Set(concreteValues);
|
||||
var abstractValue = elements.find(function (e) {
|
||||
return e instanceof AbstractValue;
|
||||
});
|
||||
(0, _invariant2.default)(abstractValue instanceof AbstractValue);
|
||||
var values = void 0;
|
||||
if (!abstractValue.values.isTop()) {
|
||||
abstractValue.values.getElements().forEach(function (v) {
|
||||
return concreteSet.add(v);
|
||||
});
|
||||
values = new _index3.ValuesDomain(concreteSet);
|
||||
} else {
|
||||
values = _index3.ValuesDomain.topVal;
|
||||
}
|
||||
var types = _index3.TypesDomain.topVal;
|
||||
|
||||
var _hashCall5 = _index2.hashCall.apply(undefined, ["abstractConcreteUnion"].concat(elements)),
|
||||
_hashCall6 = _slicedToArray(_hashCall5, 2),
|
||||
hash = _hashCall6[0],
|
||||
operands = _hashCall6[1];
|
||||
|
||||
var result = new AbstractValue(realm, types, values, hash, operands, abstractValue._buildNode, {
|
||||
kind: "abstractConcreteUnion"
|
||||
});
|
||||
result.expressionLocation = realm.currentLocation;
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "createFromWidenedProperty",
|
||||
value: function createFromWidenedProperty(realm, resultTemplate, args, buildFunction) {
|
||||
var types = resultTemplate.types;
|
||||
var values = resultTemplate.values;
|
||||
|
||||
var _hashCall7 = _index2.hashCall.apply(undefined, ["widened property"].concat(_toConsumableArray(args))),
|
||||
_hashCall8 = _slicedToArray(_hashCall7, 1),
|
||||
hash = _hashCall8[0];
|
||||
|
||||
var Constructor = _index.Value.isTypeCompatibleWith(types.getType(), _index.ObjectValue) ? _index.AbstractObjectValue : AbstractValue;
|
||||
var result = new Constructor(realm, types, values, hash, args, buildFunction);
|
||||
result.kind = "widened property";
|
||||
result.mightBeEmpty = resultTemplate.mightBeEmpty;
|
||||
result.expressionLocation = resultTemplate.expressionLocation;
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "createFromWidening",
|
||||
value: function createFromWidening(realm, value1, value2) {
|
||||
// todo: #1174 look at kind and figure out much narrower widenings
|
||||
var types = _index3.TypesDomain.joinValues(value1, value2);
|
||||
var values = _index3.ValuesDomain.topVal;
|
||||
|
||||
var _hashCall9 = (0, _index2.hashCall)("widened"),
|
||||
_hashCall10 = _slicedToArray(_hashCall9, 1),
|
||||
hash = _hashCall10[0];
|
||||
|
||||
var Constructor = _index.Value.isTypeCompatibleWith(types.getType(), _index.ObjectValue) ? _index.AbstractObjectValue : AbstractValue;
|
||||
var result = new Constructor(realm, types, values, hash, []);
|
||||
result.kind = "widened";
|
||||
result.mightBeEmpty = value1.mightHaveBeenDeleted() || value2.mightHaveBeenDeleted();
|
||||
result.expressionLocation = value1.expressionLocation;
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "generateErrorInformationForAbstractVal",
|
||||
value: function generateErrorInformationForAbstractVal(val) {
|
||||
var names = [];
|
||||
val.addSourceNamesTo(names);
|
||||
if (names.length === 0) {
|
||||
val.addSourceNamesTo(names);
|
||||
}
|
||||
return "abstract value" + (names.length > 1 ? "s" : "") + " " + names.join(" and ");
|
||||
}
|
||||
}, {
|
||||
key: "reportIntrospectionError",
|
||||
value: function reportIntrospectionError(val, propertyName) {
|
||||
var realm = val.$Realm;
|
||||
|
||||
var identity = void 0;
|
||||
if (val === realm.$GlobalObject) identity = "global";else if (val instanceof AbstractValue) {
|
||||
identity = this.generateErrorInformationForAbstractVal(val);
|
||||
} else identity = val.intrinsicName || "(some value)";
|
||||
|
||||
var source_locations = [];
|
||||
if (val instanceof AbstractValue) val.addSourceLocationsTo(source_locations);
|
||||
|
||||
var location = void 0;
|
||||
if (propertyName instanceof _index.SymbolValue) {
|
||||
var desc = propertyName.$Description;
|
||||
if (desc) {
|
||||
location = "at symbol [" + desc.throwIfNotConcreteString().value + "]";
|
||||
} else {
|
||||
location = "at symbol [" + "(no description)" + "]";
|
||||
}
|
||||
} else if (propertyName instanceof _index.StringValue) location = "at " + propertyName.value;else if (typeof propertyName === "string") location = "at " + propertyName;else location = source_locations.length === 0 ? "" : "at " + source_locations.join("\n");
|
||||
|
||||
var message = "This operation is not yet supported on " + identity + " " + location;
|
||||
|
||||
return realm.reportIntrospectionError(message);
|
||||
}
|
||||
}]);
|
||||
|
||||
return AbstractValue;
|
||||
}(_index.Value);
|
||||
|
||||
exports.default = AbstractValue;
|
||||
//# sourceMappingURL=AbstractValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/AbstractValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/AbstractValue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
245
build/node_modules/prepack/lib/values/ArgumentsExotic.js
generated
vendored
Normal file
245
build/node_modules/prepack/lib/values/ArgumentsExotic.js
generated
vendored
Normal file
@@ -0,0 +1,245 @@
|
||||
"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("../values/index.js");
|
||||
|
||||
var _is = require("../methods/is.js");
|
||||
|
||||
var _has = require("../methods/has.js");
|
||||
|
||||
var _abstract = require("../methods/abstract.js");
|
||||
|
||||
var _get = require("../methods/get.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
var _invariant = require("../invariant");
|
||||
|
||||
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 ArgumentsExotic = function (_ObjectValue) {
|
||||
_inherits(ArgumentsExotic, _ObjectValue);
|
||||
|
||||
function ArgumentsExotic(realm, intrinsicName) {
|
||||
_classCallCheck(this, ArgumentsExotic);
|
||||
|
||||
return _possibleConstructorReturn(this, (ArgumentsExotic.__proto__ || Object.getPrototypeOf(ArgumentsExotic)).call(this, realm, realm.intrinsics.ObjectPrototype, intrinsicName));
|
||||
}
|
||||
|
||||
_createClass(ArgumentsExotic, [{
|
||||
key: "$GetOwnProperty",
|
||||
|
||||
|
||||
// ECMA262 9.4.4.1
|
||||
value: function $GetOwnProperty(P) {
|
||||
// 1. Let args be the arguments object.
|
||||
var args = this;
|
||||
|
||||
// 2. Let desc be OrdinaryGetOwnProperty(args, P).
|
||||
var desc = _singletons.Properties.OrdinaryGetOwnProperty(this.$Realm, args, P);
|
||||
|
||||
// 3. If desc is undefined, return desc.
|
||||
if (desc === undefined) return undefined;
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(desc.value);
|
||||
|
||||
// 4. Let map be args.[[ParameterMap]].
|
||||
var map = args.$ParameterMap;
|
||||
(0, _invariant2.default)(map);
|
||||
|
||||
// 5. Let isMapped be ! HasOwnProperty(map, P).
|
||||
var isMapped = (0, _has.HasOwnProperty)(this.$Realm, map, P);
|
||||
|
||||
// 6. If isMapped is true, then
|
||||
if (isMapped === true) {
|
||||
// a. Set desc.[[Value]] to Get(map, P).
|
||||
desc.value = (0, _get.Get)(this.$Realm, map, P);
|
||||
}
|
||||
|
||||
// 7. Return desc.
|
||||
return desc;
|
||||
}
|
||||
|
||||
// ECMA262 9.4.4.2
|
||||
|
||||
}, {
|
||||
key: "$DefineOwnProperty",
|
||||
value: function $DefineOwnProperty(P, Desc) {
|
||||
// 1. Let args be the arguments object.
|
||||
var args = this;
|
||||
|
||||
// 2. Let map be args.[[ParameterMap]].
|
||||
var map = args.$ParameterMap;
|
||||
(0, _invariant2.default)(map);
|
||||
|
||||
// 3. Let isMapped be HasOwnProperty(map, P).
|
||||
var isMapped = (0, _has.HasOwnProperty)(this.$Realm, map, P);
|
||||
|
||||
// 4. Let newArgDesc be Desc.
|
||||
var newArgDesc = Desc;
|
||||
|
||||
// 5. If isMapped is true and IsDataDescriptor(Desc) is true, then
|
||||
if (isMapped === true && (0, _is.IsDataDescriptor)(this.$Realm, Desc) === true) {
|
||||
// a. If Desc.[[Value]] is not present and Desc.[[Writable]] is present and its value is false, then
|
||||
if (Desc.value === undefined && Desc.writable === false) {
|
||||
// i. Let newArgDesc be a copy of Desc.
|
||||
newArgDesc = Object.assign({}, Desc);
|
||||
|
||||
// ii. Set newArgDesc.[[Value]] to Get(map, P).
|
||||
newArgDesc.value = (0, _get.Get)(this.$Realm, map, P);
|
||||
}
|
||||
}
|
||||
|
||||
// 6. Let allowed be ? OrdinaryDefineOwnProperty(args, P, newArgDesc).
|
||||
var allowed = _singletons.Properties.OrdinaryDefineOwnProperty(this.$Realm, args, P, newArgDesc);
|
||||
|
||||
// 7. If allowed is false, return false.
|
||||
if (allowed === false) return false;
|
||||
|
||||
// 8. If isMapped is true, then
|
||||
if (isMapped === true) {
|
||||
// a. If IsAccessorDescriptor(Desc) is true, then
|
||||
if ((0, _is.IsAccessorDescriptor)(this.$Realm, Desc) === true) {
|
||||
// i. Call map.[[Delete]](P).
|
||||
map.$Delete(P);
|
||||
} else {
|
||||
// b. Else,
|
||||
// i. If Desc.[[Value]] is present, then
|
||||
if (Desc.value !== undefined) {
|
||||
// 1. Let setStatus be Set(map, P, Desc.[[Value]], false).
|
||||
(0, _invariant2.default)(Desc.value instanceof _index.Value);
|
||||
var setStatus = _singletons.Properties.Set(this.$Realm, map, P, Desc.value, false);
|
||||
|
||||
// 2. Assert: setStatus is true because formal parameters mapped by argument objects are always writable.
|
||||
(0, _invariant2.default)(setStatus === true);
|
||||
}
|
||||
|
||||
// ii. If Desc.[[Writable]] is present and its value is false, then
|
||||
if (Desc.writable === false) {
|
||||
// 1. Call map.[[Delete]](P).
|
||||
map.$Delete(P);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 9. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// ECMA262 9.4.4.3
|
||||
|
||||
}, {
|
||||
key: "$Get",
|
||||
value: function $Get(P, Receiver) {
|
||||
// 1. Let args be the arguments object.
|
||||
var args = this;
|
||||
|
||||
// 2. Let map be args.[[ParameterMap]].
|
||||
var map = args.$ParameterMap;
|
||||
(0, _invariant2.default)(map);
|
||||
|
||||
// 3. Let isMapped be ! HasOwnProperty(map, P).
|
||||
var isMapped = (0, _has.HasOwnProperty)(this.$Realm, map, P);
|
||||
|
||||
// 4. If isMapped is false, then
|
||||
if (isMapped === false) {
|
||||
// a. Return ? OrdinaryGet(args, P, Receiver).
|
||||
return (0, _get.OrdinaryGet)(this.$Realm, args, P, Receiver);
|
||||
} else {
|
||||
// 5. Else map contains a formal parameter mapping for P,
|
||||
// b. Return Get(map, P).
|
||||
return (0, _get.Get)(this.$Realm, map, P);
|
||||
}
|
||||
}
|
||||
|
||||
// ECMA262 9.4.4.4
|
||||
|
||||
}, {
|
||||
key: "$Set",
|
||||
value: function $Set(P, V, Receiver) {
|
||||
// 1. Let args be the arguments object.
|
||||
var args = this;
|
||||
|
||||
var isMapped = void 0,
|
||||
map = void 0;
|
||||
// 2. If SameValue(args, Receiver) is false, then
|
||||
if ((0, _abstract.SameValuePartial)(this.$Realm, args, Receiver) === false) {
|
||||
// a. Let isMapped be false.
|
||||
isMapped = false;
|
||||
} else {
|
||||
// 3. Else,
|
||||
// a. Let map be args.[[ParameterMap]].
|
||||
map = args.$ParameterMap;
|
||||
(0, _invariant2.default)(map);
|
||||
|
||||
// b. Let isMapped be ! HasOwnProperty(map, P).
|
||||
isMapped = (0, _has.HasOwnProperty)(this.$Realm, map, P);
|
||||
}
|
||||
|
||||
// 4. If isMapped is true, then
|
||||
if (isMapped === true) {
|
||||
(0, _invariant2.default)(map);
|
||||
// a. Let setStatus be Set(map, P, V, false).
|
||||
var setStatus = _singletons.Properties.Set(this.$Realm, map, P, V, false);
|
||||
|
||||
// b. Assert: setStatus is true because formal parameters mapped by argument objects are always writable.
|
||||
(0, _invariant2.default)(setStatus === true);
|
||||
}
|
||||
|
||||
// 5. Return ? OrdinarySet(args, P, V, Receiver).
|
||||
return _singletons.Properties.OrdinarySet(this.$Realm, args, P, V, Receiver);
|
||||
}
|
||||
|
||||
// ECMA262 9.4.4.5
|
||||
|
||||
}, {
|
||||
key: "$Delete",
|
||||
value: function $Delete(P) {
|
||||
// 1. Let args be the arguments object.
|
||||
var args = this;
|
||||
|
||||
// 2. Let map be args.[[ParameterMap]].
|
||||
var map = args.$ParameterMap;
|
||||
(0, _invariant2.default)(map);
|
||||
|
||||
// 3. Let isMapped be ! HasOwnProperty(map, P).
|
||||
var isMapped = (0, _has.HasOwnProperty)(this.$Realm, map, P);
|
||||
|
||||
// 4. Let result be ? OrdinaryDelete(args, P).
|
||||
var result = _singletons.Properties.OrdinaryDelete(this.$Realm, args, P);
|
||||
|
||||
// 5. If result is true and isMapped is true, then
|
||||
if (result === true && isMapped === true) {
|
||||
// a. Call map.[[Delete]](P).
|
||||
map.$Delete(P);
|
||||
}
|
||||
|
||||
// 6. Return result.
|
||||
return result;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ArgumentsExotic;
|
||||
}(_index.ObjectValue);
|
||||
|
||||
exports.default = ArgumentsExotic;
|
||||
//# sourceMappingURL=ArgumentsExotic.js.map
|
||||
1
build/node_modules/prepack/lib/values/ArgumentsExotic.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/ArgumentsExotic.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
123
build/node_modules/prepack/lib/values/ArrayValue.js
generated
vendored
Normal file
123
build/node_modules/prepack/lib/values/ArrayValue.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
"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 _is = require("../methods/is.js");
|
||||
|
||||
var _singletons = require("../singletons.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 ArrayValue = function (_ObjectValue) {
|
||||
_inherits(ArrayValue, _ObjectValue);
|
||||
|
||||
function ArrayValue(realm, intrinsicName) {
|
||||
_classCallCheck(this, ArrayValue);
|
||||
|
||||
return _possibleConstructorReturn(this, (ArrayValue.__proto__ || Object.getPrototypeOf(ArrayValue)).call(this, realm, realm.intrinsics.ArrayPrototype, intrinsicName));
|
||||
}
|
||||
|
||||
_createClass(ArrayValue, [{
|
||||
key: "getKind",
|
||||
value: function getKind() {
|
||||
return "Array";
|
||||
}
|
||||
}, {
|
||||
key: "isSimpleObject",
|
||||
value: function isSimpleObject() {
|
||||
return this.$TypedArrayName === undefined;
|
||||
}
|
||||
|
||||
// ECMA262 9.4.2.1
|
||||
|
||||
}, {
|
||||
key: "$DefineOwnProperty",
|
||||
value: function $DefineOwnProperty(P, Desc) {
|
||||
var A = this;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(this.$Realm, P), "expected a property key");
|
||||
|
||||
// 2. If P is "length", then
|
||||
if (P === "length" || P instanceof _index.StringValue && P.value === "length") {
|
||||
// a. Return ? ArraySetLength(A, Desc).
|
||||
return _singletons.Properties.ArraySetLength(this.$Realm, A, Desc);
|
||||
} else if ((0, _is.IsArrayIndex)(this.$Realm, P)) {
|
||||
// 3. Else if P is an array index, then
|
||||
|
||||
// a. Let oldLenDesc be OrdinaryGetOwnProperty(A, "length").
|
||||
var oldLenDesc = _singletons.Properties.OrdinaryGetOwnProperty(this.$Realm, A, "length");
|
||||
|
||||
// b. Assert: oldLenDesc will never be undefined or an accessor descriptor because Array objects are
|
||||
// created with a length data property that cannot be deleted or reconfigured.
|
||||
(0, _invariant2.default)(oldLenDesc !== undefined && !(0, _is.IsAccessorDescriptor)(this.$Realm, oldLenDesc), "cannot be undefined or an accessor descriptor");
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(oldLenDesc.value);
|
||||
|
||||
// c. Let oldLen be oldLenDesc.[[Value]].
|
||||
var oldLen = oldLenDesc.value;
|
||||
(0, _invariant2.default)(oldLen instanceof _index.Value);
|
||||
oldLen = oldLen.throwIfNotConcrete();
|
||||
(0, _invariant2.default)(oldLen instanceof _index.NumberValue, "expected number value");
|
||||
oldLen = oldLen.value;
|
||||
|
||||
// d. Let index be ! ToUint32(P).
|
||||
var index = _singletons.To.ToUint32(this.$Realm, typeof P === "string" ? new _index.StringValue(this.$Realm, P) : P);
|
||||
|
||||
// e. If index ≥ oldLen and oldLenDesc.[[Writable]] is false, return false.
|
||||
if (index >= oldLen && oldLenDesc.writable === false) return false;
|
||||
|
||||
// f. Let succeeded be ! OrdinaryDefineOwnProperty(A, P, Desc).
|
||||
var succeeded = _singletons.Properties.OrdinaryDefineOwnProperty(this.$Realm, A, P, Desc);
|
||||
|
||||
// g. If succeeded is false, return false.
|
||||
if (succeeded === false) return false;
|
||||
|
||||
// h. If index ≥ oldLen, then
|
||||
if (index >= oldLen) {
|
||||
// i. Set oldLenDesc.[[Value]] to index + 1.
|
||||
oldLenDesc.value = new _index.NumberValue(this.$Realm, index + 1);
|
||||
|
||||
// ii. Let succeeded be OrdinaryDefineOwnProperty(A, "length", oldLenDesc).
|
||||
succeeded = _singletons.Properties.OrdinaryDefineOwnProperty(this.$Realm, A, "length", oldLenDesc);
|
||||
|
||||
// iii. Assert: succeeded is true.
|
||||
(0, _invariant2.default)(succeeded, "expected length definition to succeed");
|
||||
}
|
||||
|
||||
// i. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// 1. Return OrdinaryDefineOwnProperty(A, P, Desc).
|
||||
return _singletons.Properties.OrdinaryDefineOwnProperty(this.$Realm, A, P, Desc);
|
||||
}
|
||||
}]);
|
||||
|
||||
return ArrayValue;
|
||||
}(_index.ObjectValue);
|
||||
|
||||
exports.default = ArrayValue;
|
||||
//# sourceMappingURL=ArrayValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/ArrayValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/ArrayValue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
77
build/node_modules/prepack/lib/values/BooleanValue.js
generated
vendored
Normal file
77
build/node_modules/prepack/lib/values/BooleanValue.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"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");
|
||||
|
||||
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 BooleanValue = function (_PrimitiveValue) {
|
||||
_inherits(BooleanValue, _PrimitiveValue);
|
||||
|
||||
function BooleanValue(realm, value, intrinsicName) {
|
||||
var _ret, _ret2;
|
||||
|
||||
_classCallCheck(this, BooleanValue);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (BooleanValue.__proto__ || Object.getPrototypeOf(BooleanValue)).call(this, realm, intrinsicName));
|
||||
|
||||
_this.value = value;
|
||||
|
||||
if (value && realm.intrinsics.true) return _ret = realm.intrinsics.true, _possibleConstructorReturn(_this, _ret);
|
||||
if (!value && realm.intrinsics.false) return _ret2 = realm.intrinsics.false, _possibleConstructorReturn(_this, _ret2);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(BooleanValue, [{
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof BooleanValue && this.value === x.value;
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
return this.value ? 12484058682847432 : 3777063795205331;
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
return !this.value;
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteBoolean",
|
||||
value: function throwIfNotConcreteBoolean() {
|
||||
return this;
|
||||
}
|
||||
}, {
|
||||
key: "_serialize",
|
||||
value: function _serialize() {
|
||||
return this.value;
|
||||
}
|
||||
}, {
|
||||
key: "toDisplayString",
|
||||
value: function toDisplayString() {
|
||||
return this.value.toString();
|
||||
}
|
||||
}]);
|
||||
|
||||
return BooleanValue;
|
||||
}(_index.PrimitiveValue);
|
||||
|
||||
exports.default = BooleanValue;
|
||||
//# sourceMappingURL=BooleanValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/BooleanValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/BooleanValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/BooleanValue.js"],"names":["BooleanValue","realm","value","intrinsicName","intrinsics","true","false","x","toString"],"mappings":";;;;;;;;AAWA;;;;;;+eAXA;;;;;;;;;IAcqBA,Y;;;AACnB,wBAAYC,KAAZ,EAA0BC,KAA1B,EAA0CC,aAA1C,EAAkE;AAAA;;AAAA;;AAAA,4HAC1DF,KAD0D,EACnDE,aADmD;;AAEhE,UAAKD,KAAL,GAAaA,KAAb;;AAEA,QAAIA,SAASD,MAAMG,UAAN,CAAiBC,IAA9B,EAAoC,cAAOJ,MAAMG,UAAN,CAAiBC,IAAxB;AACpC,QAAI,CAACH,KAAD,IAAUD,MAAMG,UAAN,CAAiBE,KAA/B,EAAsC,eAAOL,MAAMG,UAAN,CAAiBE,KAAxB;AAL0B;AAMjE;;;;2BAIMC,C,EAAmB;AACxB,aAAOA,aAAaP,YAAb,IAA6B,KAAKE,KAAL,KAAeK,EAAEL,KAArD;AACD;;;8BAEiB;AAChB,aAAO,KAAKA,KAAL,GAAa,iBAAb,GAAiC,gBAAxC;AACD;;;mCAEuB;AACtB,aAAO,CAAC,KAAKA,KAAb;AACD;;;gDAEyC;AACxC,aAAO,IAAP;AACD;;;iCAEqB;AACpB,aAAO,KAAKA,KAAZ;AACD;;;sCAEyB;AACxB,aAAO,KAAKA,KAAL,CAAWM,QAAX,EAAP;AACD;;;;;;kBAjCkBR,Y","file":"BooleanValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { PrimitiveValue, Value } from \"./index.js\";\nimport type { Realm } from \"../realm.js\";\n\nexport default class BooleanValue extends PrimitiveValue {\n constructor(realm: Realm, value: boolean, intrinsicName?: string) {\n super(realm, intrinsicName);\n this.value = value;\n\n if (value && realm.intrinsics.true) return realm.intrinsics.true;\n if (!value && realm.intrinsics.false) return realm.intrinsics.false;\n }\n\n value: boolean;\n\n equals(x: Value): boolean {\n return x instanceof BooleanValue && this.value === x.value;\n }\n\n getHash(): number {\n return this.value ? 12484058682847432 : 3777063795205331;\n }\n\n mightBeFalse(): boolean {\n return !this.value;\n }\n\n throwIfNotConcreteBoolean(): BooleanValue {\n return this;\n }\n\n _serialize(): boolean {\n return this.value;\n }\n\n toDisplayString(): string {\n return this.value.toString();\n }\n}\n"]}
|
||||
63
build/node_modules/prepack/lib/values/BoundFunctionValue.js
generated
vendored
Normal file
63
build/node_modules/prepack/lib/values/BoundFunctionValue.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"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.
|
||||
*/
|
||||
|
||||
/* Bound Function Exotic Objects */
|
||||
var BoundFunctionValue = function (_FunctionValue) {
|
||||
_inherits(BoundFunctionValue, _FunctionValue);
|
||||
|
||||
function BoundFunctionValue(realm, intrinsicName) {
|
||||
_classCallCheck(this, BoundFunctionValue);
|
||||
|
||||
return _possibleConstructorReturn(this, (BoundFunctionValue.__proto__ || Object.getPrototypeOf(BoundFunctionValue)).call(this, realm, intrinsicName));
|
||||
}
|
||||
|
||||
_createClass(BoundFunctionValue, [{
|
||||
key: "getName",
|
||||
|
||||
|
||||
// Override.
|
||||
value: function getName() {
|
||||
return "Bound";
|
||||
}
|
||||
}, {
|
||||
key: "hasDefaultLength",
|
||||
value: function hasDefaultLength() {
|
||||
var f = this.$BoundTargetFunction;
|
||||
if (!(f instanceof _index.FunctionValue) || !f.hasDefaultLength()) return false;
|
||||
var fl = f.getLength();
|
||||
(0, _invariant2.default)(fl !== undefined);
|
||||
return this.getLength() === Math.max(fl - this.$BoundArguments.length, 0);
|
||||
}
|
||||
}]);
|
||||
|
||||
return BoundFunctionValue;
|
||||
}(_index.FunctionValue);
|
||||
|
||||
exports.default = BoundFunctionValue;
|
||||
//# sourceMappingURL=BoundFunctionValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/BoundFunctionValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/BoundFunctionValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/BoundFunctionValue.js"],"names":["BoundFunctionValue","realm","intrinsicName","f","$BoundTargetFunction","hasDefaultLength","fl","getLength","undefined","Math","max","$BoundArguments","length"],"mappings":";;;;;;;;AAYA;;AACA;;;;;;;;;;+eAbA;;;;;;;;;AAeA;IACqBA,kB;;;AACnB,8BAAYC,KAAZ,EAA0BC,aAA1B,EAAkD;AAAA;;AAAA,mIAC1CD,KAD0C,EACnCC,aADmC;AAEjD;;;;;;AAMD;8BACkB;AAChB,aAAO,OAAP;AACD;;;uCAE2B;AAC1B,UAAIC,IAAI,KAAKC,oBAAb;AACA,UAAI,EAAED,iCAAF,KAAiC,CAACA,EAAEE,gBAAF,EAAtC,EAA4D,OAAO,KAAP;AAC5D,UAAIC,KAAKH,EAAEI,SAAF,EAAT;AACA,+BAAUD,OAAOE,SAAjB;AACA,aAAO,KAAKD,SAAL,OAAqBE,KAAKC,GAAL,CAASJ,KAAK,KAAKK,eAAL,CAAqBC,MAAnC,EAA2C,CAA3C,CAA5B;AACD;;;;;;kBApBkBZ,kB","file":"BoundFunctionValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { Realm } from \"../realm.js\";\nimport { Value, FunctionValue, ObjectValue } from \"./index.js\";\nimport invariant from \"../invariant.js\";\n\n/* Bound Function Exotic Objects */\nexport default class BoundFunctionValue extends FunctionValue {\n constructor(realm: Realm, intrinsicName?: string) {\n super(realm, intrinsicName);\n }\n\n $BoundTargetFunction: ObjectValue;\n $BoundThis: Value;\n $BoundArguments: Array<Value>;\n\n // Override.\n getName(): string {\n return \"Bound\";\n }\n\n hasDefaultLength(): boolean {\n let f = this.$BoundTargetFunction;\n if (!(f instanceof FunctionValue) || !f.hasDefaultLength()) return false;\n let fl = f.getLength();\n invariant(fl !== undefined);\n return this.getLength() === Math.max(fl - this.$BoundArguments.length, 0);\n }\n}\n"]}
|
||||
152
build/node_modules/prepack/lib/values/ConcreteValue.js
generated
vendored
Normal file
152
build/node_modules/prepack/lib/values/ConcreteValue.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
"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
|
||||
1
build/node_modules/prepack/lib/values/ConcreteValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/ConcreteValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/ConcreteValue.js"],"names":["ConcreteValue","realm","intrinsicName","mightBeFalse","$Realm","intrinsics","undefined","throwIfNotObject"],"mappings":";;;;;;;;AAYA;;AAYA;;;;;;;;;;+eAxBA;;;;;;;;;IA0BqBA,a;;;AACnB,yBAAYC,KAAZ,EAA0BC,aAA1B,EAAkD;AAAA;;AAChD,6BAAUD,KAAV,EAAiB,gBAAjB;AADgD,yHAE1CA,KAF0C,EAEnCC,aAFmC;AAGjD;;;;sCAE0B;AACzB,aAAO,CAAC,KAAKC,YAAL,EAAR;AACD;;;kCAEsB;AACrB,aAAO,gCAAP;AACD;;;qCAEyB;AACxB,aAAO,EAAE,gCAAF,CAAP;AACD;;;oCAEwB;AACvB,aAAO,kCAAP;AACD;;;uCAE2B;AAC1B,aAAO,EAAE,kCAAF,CAAP;AACD;;;uCAE2B;AAC1B,aAAO,EAAE,kCAAF,CAAP;AACD;;;oCAEwB;AACvB,aAAO,kCAAP;AACD;;;oCAEwB;AACvB,aAAO,kCAAP;AACD;;;uCAE2B;AAC1B,aAAO,EAAE,kCAAF,CAAP;AACD;;;uCAE2B;AAC1B,aAAO,qCAAP;AACD;;;0CAE8B;AAC7B,aAAO,EAAE,qCAAF,CAAP;AACD;;;2CAE+B;AAC9B,aAAO,iCAAP;AACD;;;8CAEgC;AAC/B,UAAI,iCAAJ,EAAgC,OAAO,KAAKC,MAAL,CAAYC,UAAZ,CAAuBC,SAA9B;AAChC,aAAO,IAAP;AACD;;;yCAEmC;AAClC,aAAO,IAAP;AACD;;;+CAEuC;AACtC,+BAAU,KAAV,EAAiB,0CAAjB;AACD;;;+CAEuC;AACtC,+BAAU,KAAV,EAAiB,0CAAjB;AACD;;;gDAEyC;AACxC,+BAAU,KAAV,EAAiB,2CAAjB;AACD;;;+CAEuC;AACtC,+BAAU,KAAV,EAAiB,0CAAjB;AACD;;;+CAEuC;AACtC,aAAO,KAAKC,gBAAL,EAAP;AACD;;;kDAE6C;AAC5C,+BAAU,KAAV,EAAiB,mDAAjB;AACD;;;uCAE+B;AAC9B,+BAAU,KAAV,EAAiB,2CAAjB;AACD;;;;;;kBAzFkBP,a","file":"ConcreteValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { Realm } from \"../realm.js\";\nimport {\n EmptyValue,\n NullValue,\n NumberValue,\n ObjectValue,\n PrimitiveValue,\n StringValue,\n BooleanValue,\n SymbolValue,\n UndefinedValue,\n Value,\n} from \"./index.js\";\nimport invariant from \"../invariant.js\";\n\nexport default class ConcreteValue extends Value {\n constructor(realm: Realm, intrinsicName?: string) {\n invariant(realm, \"realm required\");\n super(realm, intrinsicName);\n }\n\n mightNotBeFalse(): boolean {\n return !this.mightBeFalse();\n }\n\n mightBeNull(): boolean {\n return this instanceof NullValue;\n }\n\n mightNotBeNull(): boolean {\n return !(this instanceof NullValue);\n }\n\n mightBeNumber(): boolean {\n return this instanceof NumberValue;\n }\n\n mightNotBeNumber(): boolean {\n return !(this instanceof NumberValue);\n }\n\n mightNotBeObject(): boolean {\n return !(this instanceof ObjectValue);\n }\n\n mightBeObject(): boolean {\n return this instanceof ObjectValue;\n }\n\n mightBeString(): boolean {\n return this instanceof StringValue;\n }\n\n mightNotBeString(): boolean {\n return !(this instanceof StringValue);\n }\n\n mightBeUndefined(): boolean {\n return this instanceof UndefinedValue;\n }\n\n mightNotBeUndefined(): boolean {\n return !(this instanceof UndefinedValue);\n }\n\n mightHaveBeenDeleted(): boolean {\n return this instanceof EmptyValue;\n }\n\n promoteEmptyToUndefined(): Value {\n if (this instanceof EmptyValue) return this.$Realm.intrinsics.undefined;\n return this;\n }\n\n throwIfNotConcrete(): ConcreteValue {\n return this;\n }\n\n throwIfNotConcreteNumber(): NumberValue {\n invariant(false, \"expected this to be a number if concrete\");\n }\n\n throwIfNotConcreteString(): StringValue {\n invariant(false, \"expected this to be a string if concrete\");\n }\n\n throwIfNotConcreteBoolean(): BooleanValue {\n invariant(false, \"expected this to be a boolean if concrete\");\n }\n\n throwIfNotConcreteSymbol(): SymbolValue {\n invariant(false, \"expected this to be a symbol if concrete\");\n }\n\n throwIfNotConcreteObject(): ObjectValue {\n return this.throwIfNotObject();\n }\n\n throwIfNotConcretePrimitive(): PrimitiveValue {\n invariant(false, \"expected this to be a primitive value if concrete\");\n }\n\n throwIfNotObject(): ObjectValue {\n invariant(false, \"expected this to be an object if concrete\");\n }\n}\n"]}
|
||||
36
build/node_modules/prepack/lib/values/ECMAScriptFunctionValue.js
generated
vendored
Normal file
36
build/node_modules/prepack/lib/values/ECMAScriptFunctionValue.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _index = require("./index.js");
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/* Abstract base class for non-exotic function objects(either with source or built-in) */
|
||||
var ECMAScriptFunctionValue = function (_FunctionValue) {
|
||||
_inherits(ECMAScriptFunctionValue, _FunctionValue);
|
||||
|
||||
function ECMAScriptFunctionValue(realm, intrinsicName) {
|
||||
_classCallCheck(this, ECMAScriptFunctionValue);
|
||||
|
||||
return _possibleConstructorReturn(this, (ECMAScriptFunctionValue.__proto__ || Object.getPrototypeOf(ECMAScriptFunctionValue)).call(this, realm, intrinsicName));
|
||||
}
|
||||
|
||||
return ECMAScriptFunctionValue;
|
||||
}(_index.FunctionValue);
|
||||
|
||||
exports.default = ECMAScriptFunctionValue;
|
||||
//# sourceMappingURL=ECMAScriptFunctionValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/ECMAScriptFunctionValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/ECMAScriptFunctionValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/ECMAScriptFunctionValue.js"],"names":["ECMAScriptFunctionValue","realm","intrinsicName"],"mappings":";;;;;;AAaA;;;;;;+eAbA;;;;;;;;;AAeA;IACqBA,uB;;;AACnB,mCAAYC,KAAZ,EAA0BC,aAA1B,EAAkD;AAAA;;AAAA,6IAC1CD,KAD0C,EACnCC,aADmC;AAEjD;;;;;kBAHkBF,uB","file":"ECMAScriptFunctionValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { Realm } from \"../realm.js\";\nimport type { ObjectValue } from \"./index.js\";\nimport { FunctionValue } from \"./index.js\";\n\n/* Abstract base class for non-exotic function objects(either with source or built-in) */\nexport default class ECMAScriptFunctionValue extends FunctionValue {\n constructor(realm: Realm, intrinsicName?: string) {\n super(realm, intrinsicName);\n }\n\n $ConstructorKind: \"base\" | \"derived\";\n $ThisMode: \"lexical\" | \"strict\" | \"global\";\n $HomeObject: void | ObjectValue;\n $FunctionKind: \"normal\" | \"classConstructor\" | \"generator\";\n}\n"]}
|
||||
77
build/node_modules/prepack/lib/values/ECMAScriptSourceFunctionValue.js
generated
vendored
Normal file
77
build/node_modules/prepack/lib/values/ECMAScriptSourceFunctionValue.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"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 _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
var _invariant = require("../invariant");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/* Non built-in ECMAScript function objects with source code */
|
||||
var ECMAScriptSourceFunctionValue = function (_ECMAScriptFunctionVa) {
|
||||
_inherits(ECMAScriptSourceFunctionValue, _ECMAScriptFunctionVa);
|
||||
|
||||
function ECMAScriptSourceFunctionValue(realm, intrinsicName) {
|
||||
_classCallCheck(this, ECMAScriptSourceFunctionValue);
|
||||
|
||||
return _possibleConstructorReturn(this, (ECMAScriptSourceFunctionValue.__proto__ || Object.getPrototypeOf(ECMAScriptSourceFunctionValue)).call(this, realm, intrinsicName));
|
||||
}
|
||||
|
||||
_createClass(ECMAScriptSourceFunctionValue, [{
|
||||
key: "getName",
|
||||
|
||||
|
||||
// Override.
|
||||
value: function getName() {
|
||||
var uniqueTag = this.$ECMAScriptCode.uniqueOrderedTag;
|
||||
// Should only be called after the function is initialized.
|
||||
(0, _invariant2.default)(uniqueTag);
|
||||
return this.__originalName ? this.__originalName : "f#" + uniqueTag;
|
||||
}
|
||||
}, {
|
||||
key: "hasDefaultLength",
|
||||
value: function hasDefaultLength() {
|
||||
var params = this.$FormalParameters;
|
||||
var expected = params.length;
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var param = params[i];
|
||||
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
|
||||
expected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return expected === this.getLength();
|
||||
}
|
||||
}]);
|
||||
|
||||
return ECMAScriptSourceFunctionValue;
|
||||
}(_index.ECMAScriptFunctionValue);
|
||||
|
||||
exports.default = ECMAScriptSourceFunctionValue;
|
||||
//# sourceMappingURL=ECMAScriptSourceFunctionValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/ECMAScriptSourceFunctionValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/ECMAScriptSourceFunctionValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/ECMAScriptSourceFunctionValue.js"],"names":["t","ECMAScriptSourceFunctionValue","realm","intrinsicName","uniqueTag","$ECMAScriptCode","uniqueOrderedTag","__originalName","params","$FormalParameters","expected","length","i","param","isAssignmentPattern","isRestElement","getLength"],"mappings":";;;;;;;;AAcA;;AACA;;IAAYA,C;;AACZ;;;;;;;;;;;;+eAhBA;;;;;;;;;AAkBA;IACqBC,6B;;;AACnB,yCAAYC,KAAZ,EAA0BC,aAA1B,EAAkD;AAAA;;AAAA,yJAC1CD,KAD0C,EACnCC,aADmC;AAEjD;;;;;;AAOD;8BACkB;AAChB,UAAMC,YAAc,KAAKC,eAAP,CAAmDC,gBAArE;AACA;AACA,+BAAUF,SAAV;AACA,aAAO,KAAKG,cAAL,GAAsB,KAAKA,cAA3B,UAAiDH,SAAxD;AACD;;;uCAE2B;AAC1B,UAAII,SAAS,KAAKC,iBAAlB;AACA,UAAIC,WAAWF,OAAOG,MAAtB;AACA,WAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIJ,OAAOG,MAA3B,EAAmCC,GAAnC,EAAwC;AACtC,YAAIC,QAAQL,OAAOI,CAAP,CAAZ;AACA,YAAIZ,EAAEc,mBAAF,CAAsBD,KAAtB,KAAgCb,EAAEe,aAAF,CAAgBF,KAAhB,CAApC,EAA4D;AAC1DH,qBAAWE,CAAX;AACA;AACD;AACF;AACD,aAAOF,aAAa,KAAKM,SAAL,EAApB;AACD;;;;;;kBA7BkBf,6B","file":"ECMAScriptSourceFunctionValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { Realm } from \"../realm.js\";\nimport type { BabelNodeBlockStatement, BabelNodeSourceLocation, BabelNodeLVal } from \"babel-types\";\nimport type { FunctionBodyAstNode } from \"../types.js\";\nimport { ECMAScriptFunctionValue } from \"./index.js\";\nimport * as t from \"babel-types\";\nimport invariant from \"../invariant\";\n\n/* Non built-in ECMAScript function objects with source code */\nexport default class ECMAScriptSourceFunctionValue extends ECMAScriptFunctionValue {\n constructor(realm: Realm, intrinsicName?: string) {\n super(realm, intrinsicName);\n }\n\n $Strict: boolean;\n $FormalParameters: Array<BabelNodeLVal>;\n $ECMAScriptCode: BabelNodeBlockStatement;\n loc: ?BabelNodeSourceLocation;\n\n // Override.\n getName(): string {\n const uniqueTag = ((this.$ECMAScriptCode: any): FunctionBodyAstNode).uniqueOrderedTag;\n // Should only be called after the function is initialized.\n invariant(uniqueTag);\n return this.__originalName ? this.__originalName : `f#${uniqueTag}`;\n }\n\n hasDefaultLength(): boolean {\n let params = this.$FormalParameters;\n let expected = params.length;\n for (let i = 0; i < params.length; i++) {\n let param = params[i];\n if (t.isAssignmentPattern(param) || t.isRestElement(param)) {\n expected = i;\n break;\n }\n }\n return expected === this.getLength();\n }\n}\n"]}
|
||||
49
build/node_modules/prepack/lib/values/EmptyValue.js
generated
vendored
Normal file
49
build/node_modules/prepack/lib/values/EmptyValue.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"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");
|
||||
|
||||
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 EmptyValue = function (_UndefinedValue) {
|
||||
_inherits(EmptyValue, _UndefinedValue);
|
||||
|
||||
function EmptyValue() {
|
||||
_classCallCheck(this, EmptyValue);
|
||||
|
||||
return _possibleConstructorReturn(this, (EmptyValue.__proto__ || Object.getPrototypeOf(EmptyValue)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(EmptyValue, [{
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
return 4523845144584502;
|
||||
}
|
||||
}, {
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof EmptyValue;
|
||||
}
|
||||
}]);
|
||||
|
||||
return EmptyValue;
|
||||
}(_index.UndefinedValue);
|
||||
|
||||
exports.default = EmptyValue;
|
||||
//# sourceMappingURL=EmptyValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/EmptyValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/EmptyValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/EmptyValue.js"],"names":["EmptyValue","x"],"mappings":";;;;;;;;AAWA;;;;;;+eAXA;;;;;;;;;IAaqBA,U;;;;;;;;;;;8BACD;AAChB,aAAO,gBAAP;AACD;;;2BAEMC,C,EAAmB;AACxB,aAAOA,aAAaD,UAApB;AACD;;;;;;kBAPkBA,U","file":"EmptyValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { UndefinedValue, Value } from \"./index.js\";\n\nexport default class EmptyValue extends UndefinedValue {\n getHash(): number {\n return 4523845144584502;\n }\n\n equals(x: Value): boolean {\n return x instanceof EmptyValue;\n }\n}\n"]}
|
||||
90
build/node_modules/prepack/lib/values/FunctionValue.js
generated
vendored
Normal file
90
build/node_modules/prepack/lib/values/FunctionValue.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"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 _generator = require("../utils/generator.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.
|
||||
*/
|
||||
|
||||
/* Abstract base class for all function objects */
|
||||
var FunctionValue = function (_ObjectValue) {
|
||||
_inherits(FunctionValue, _ObjectValue);
|
||||
|
||||
function FunctionValue(realm, intrinsicName) {
|
||||
_classCallCheck(this, FunctionValue);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (FunctionValue.__proto__ || Object.getPrototypeOf(FunctionValue)).call(this, realm, realm.intrinsics.FunctionPrototype, intrinsicName));
|
||||
|
||||
_this.parent = realm.generator;
|
||||
return _this;
|
||||
}
|
||||
|
||||
// Indicates whether this function has been referenced by a __residual call.
|
||||
// If true, the serializer will check that the function does not access any
|
||||
// identifiers defined outside of the local scope.
|
||||
|
||||
|
||||
// Allows for residual function with inference of parameters
|
||||
|
||||
|
||||
_createClass(FunctionValue, [{
|
||||
key: "getName",
|
||||
value: function getName() {
|
||||
throw new Error("Abstract method");
|
||||
}
|
||||
}, {
|
||||
key: "getKind",
|
||||
value: function getKind() {
|
||||
return "Function";
|
||||
}
|
||||
}, {
|
||||
key: "getLength",
|
||||
value: function getLength() {
|
||||
var binding = this.properties.get("length");
|
||||
(0, _invariant2.default)(binding);
|
||||
var desc = binding.descriptor;
|
||||
(0, _invariant2.default)(desc);
|
||||
var value = desc.value;
|
||||
if (!(value instanceof _index.NumberValue)) return undefined;
|
||||
return value.value;
|
||||
}
|
||||
}, {
|
||||
key: "getParent",
|
||||
value: function getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
}, {
|
||||
key: "hasDefaultLength",
|
||||
value: function hasDefaultLength() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}]);
|
||||
|
||||
return FunctionValue;
|
||||
}(_index.ObjectValue);
|
||||
|
||||
exports.default = FunctionValue;
|
||||
//# sourceMappingURL=FunctionValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/FunctionValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/FunctionValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/FunctionValue.js"],"names":["FunctionValue","realm","intrinsicName","intrinsics","FunctionPrototype","parent","generator","Error","binding","properties","get","desc","descriptor","value","undefined"],"mappings":";;;;;;;;AAcA;;AACA;;AACA;;;;;;;;;;+eAhBA;;;;;;;;;AAkBA;IACqBA,a;;;AACnB,yBAAYC,KAAZ,EAA0BC,aAA1B,EAAkD;AAAA;;AAAA,8HAC1CD,KAD0C,EACnCA,MAAME,UAAN,CAAiBC,iBADkB,EACCF,aADD;;AAEhD,UAAKG,MAAL,GAAcJ,MAAMK,SAApB;AAFgD;AAGjD;;AAMD;AACA;AACA;;;AAGA;;;;;8BAGkB;AAChB,YAAM,IAAIC,KAAJ,CAAU,iBAAV,CAAN;AACD;;;8BAEqB;AACpB,aAAO,UAAP;AACD;;;gCAE0B;AACzB,UAAIC,UAAU,KAAKC,UAAL,CAAgBC,GAAhB,CAAoB,QAApB,CAAd;AACA,+BAAUF,OAAV;AACA,UAAIG,OAAOH,QAAQI,UAAnB;AACA,+BAAUD,IAAV;AACA,UAAIE,QAAQF,KAAKE,KAAjB;AACA,UAAI,EAAEA,mCAAF,CAAJ,EAAqC,OAAOC,SAAP;AACrC,aAAOD,MAAMA,KAAb;AACD;;;gCAE6B;AAC5B,aAAO,KAAKR,MAAZ;AACD;;;uCAE2B;AAC1B,+BAAU,KAAV,EAAiB,kCAAjB;AACD;;;;;;kBA1CkBL,a","file":"FunctionValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { ObjectKind } from \"../types.js\";\nimport type { LexicalEnvironment } from \"../environment.js\";\nimport type { Realm } from \"../realm.js\";\nimport { ObjectValue, NumberValue } from \"./index.js\";\nimport { Generator } from \"../utils/generator.js\";\nimport invariant from \"../invariant.js\";\n\n/* Abstract base class for all function objects */\nexport default class FunctionValue extends ObjectValue {\n constructor(realm: Realm, intrinsicName?: string) {\n super(realm, realm.intrinsics.FunctionPrototype, intrinsicName);\n this.parent = realm.generator;\n }\n\n parent: void | Generator;\n $Environment: LexicalEnvironment;\n $ScriptOrModule: any;\n\n // Indicates whether this function has been referenced by a __residual call.\n // If true, the serializer will check that the function does not access any\n // identifiers defined outside of the local scope.\n isResidual: void | true;\n\n // Allows for residual function with inference of parameters\n isUnsafeResidual: void | true;\n\n getName(): string {\n throw new Error(\"Abstract method\");\n }\n\n getKind(): ObjectKind {\n return \"Function\";\n }\n\n getLength(): void | number {\n let binding = this.properties.get(\"length\");\n invariant(binding);\n let desc = binding.descriptor;\n invariant(desc);\n let value = desc.value;\n if (!(value instanceof NumberValue)) return undefined;\n return value.value;\n }\n\n getParent(): void | Generator {\n return this.parent;\n }\n\n hasDefaultLength(): boolean {\n invariant(false, \"abstract method; please override\");\n }\n}\n"]}
|
||||
352
build/node_modules/prepack/lib/values/IntegerIndexedExotic.js
generated
vendored
Normal file
352
build/node_modules/prepack/lib/values/IntegerIndexedExotic.js
generated
vendored
Normal file
@@ -0,0 +1,352 @@
|
||||
"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("../values/index.js");
|
||||
|
||||
var _is = require("../methods/is.js");
|
||||
|
||||
var _get = require("../methods/get.js");
|
||||
|
||||
var _has = require("../methods/has.js");
|
||||
|
||||
var _typedarray = require("../methods/typedarray.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
var _invariant = require("../invariant");
|
||||
|
||||
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 IntegerIndexedExotic = function (_ObjectValue) {
|
||||
_inherits(IntegerIndexedExotic, _ObjectValue);
|
||||
|
||||
function IntegerIndexedExotic(realm, intrinsicName) {
|
||||
_classCallCheck(this, IntegerIndexedExotic);
|
||||
|
||||
return _possibleConstructorReturn(this, (IntegerIndexedExotic.__proto__ || Object.getPrototypeOf(IntegerIndexedExotic)).call(this, realm, realm.intrinsics.ObjectPrototype, intrinsicName));
|
||||
}
|
||||
|
||||
// ECMA262 9.4.5.1
|
||||
|
||||
|
||||
_createClass(IntegerIndexedExotic, [{
|
||||
key: "$GetOwnProperty",
|
||||
value: function $GetOwnProperty(P) {
|
||||
var O = this;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(this.$Realm, P), "IsPropertyKey(P) is true");
|
||||
|
||||
// 2. Assert: O is an Object that has a [[ViewedArrayBuffer]] internal slot.
|
||||
(0, _invariant2.default)(O instanceof _index.ObjectValue && O.$ViewedArrayBuffer);
|
||||
|
||||
// 3. If Type(P) is String, then
|
||||
if (typeof P === "string" || P instanceof _index.StringValue) {
|
||||
// a. Let numericIndex be ! CanonicalNumericIndexString(P).
|
||||
var numericIndex = _singletons.To.CanonicalNumericIndexString(this.$Realm, typeof P === "string" ? new _index.StringValue(this.$Realm, P) : P);
|
||||
|
||||
// b. If numericIndex is not undefined, then
|
||||
if (numericIndex !== undefined) {
|
||||
// i. Let value be ? IntegerIndexedElementGet(O, numericIndex).
|
||||
var value = (0, _typedarray.IntegerIndexedElementGet)(this.$Realm, O, numericIndex);
|
||||
|
||||
// ii. If value is undefined, return undefined.
|
||||
if (value instanceof _index.UndefinedValue) return undefined;
|
||||
|
||||
// iii. Return a PropertyDescriptor{[[Value]]: value, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: false}.
|
||||
return {
|
||||
value: value,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: false
|
||||
};
|
||||
}
|
||||
}
|
||||
// 4. Return OrdinaryGetOwnProperty(O, P).
|
||||
return _singletons.Properties.OrdinaryGetOwnProperty(this.$Realm, O, P);
|
||||
}
|
||||
|
||||
// ECMA262 9.4.5.2
|
||||
|
||||
}, {
|
||||
key: "$HasProperty",
|
||||
value: function $HasProperty(P) {
|
||||
var O = this;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(this.$Realm, P), "IsPropertyKey(P) is true");
|
||||
|
||||
// 2. Assert: O is an Object that has a [[ViewedArrayBuffer]] internal slot.
|
||||
(0, _invariant2.default)(O instanceof _index.ObjectValue && O.$ViewedArrayBuffer);
|
||||
|
||||
// 3. If Type(P) is String, then
|
||||
if (typeof P === "string" || P instanceof _index.StringValue) {
|
||||
// a. Let numericIndex be ! CanonicalNumericIndexString(P).
|
||||
var numericIndex = _singletons.To.CanonicalNumericIndexString(this.$Realm, typeof P === "string" ? new _index.StringValue(this.$Realm, P) : P);
|
||||
|
||||
// b. If numericIndex is not undefined, then
|
||||
if (numericIndex !== undefined) {
|
||||
// i. Let buffer be O.[[ViewedArrayBuffer]].
|
||||
var buffer = O.$ViewedArrayBuffer;
|
||||
(0, _invariant2.default)(buffer);
|
||||
|
||||
// ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
|
||||
if ((0, _is.IsDetachedBuffer)(this.$Realm, buffer) === true) {
|
||||
throw this.$Realm.createErrorThrowCompletion(this.$Realm.intrinsics.TypeError, "IsDetachedBuffer(buffer) is true");
|
||||
}
|
||||
|
||||
// iii. If IsInteger(numericIndex) is false, return false.
|
||||
if ((0, _is.IsInteger)(this.$Realm, numericIndex) === false) return false;
|
||||
|
||||
// iv. If numericIndex = -0, return false.
|
||||
if (Object.is(numericIndex, -0)) return false;
|
||||
|
||||
// v. If numericIndex < 0, return false.
|
||||
if (numericIndex < 0) return false;
|
||||
|
||||
// vi. If numericIndex ≥ O.[[ArrayLength]], return false.
|
||||
(0, _invariant2.default)(O.$ArrayLength);
|
||||
if (numericIndex >= O.$ArrayLength) return false;
|
||||
|
||||
// vii. Return true.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Return ? OrdinaryHasProperty(O, P).
|
||||
return (0, _has.OrdinaryHasProperty)(this.$Realm, O, P);
|
||||
}
|
||||
|
||||
// ECMA262 9.4.5.3
|
||||
|
||||
}, {
|
||||
key: "$DefineOwnProperty",
|
||||
value: function $DefineOwnProperty(P, Desc) {
|
||||
var O = this;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(this.$Realm, P), "IsPropertyKey(P) is true");
|
||||
|
||||
// 2. Assert: O is an Object that has a [[ViewedArrayBuffer]] internal slot.
|
||||
(0, _invariant2.default)(O instanceof _index.ObjectValue && this.$ViewedArrayBuffer);
|
||||
|
||||
// 3. If Type(P) is String, then
|
||||
if (typeof P === "string" || P instanceof _index.StringValue) {
|
||||
// a. Let numericIndex be ! CanonicalNumericIndexString(P).
|
||||
var numericIndex = _singletons.To.CanonicalNumericIndexString(this.$Realm, typeof P === "string" ? new _index.StringValue(this.$Realm, P) : P);
|
||||
|
||||
// b. If numericIndex is not undefined, then
|
||||
if (numericIndex !== undefined) {
|
||||
// i. If IsInteger(numericIndex) is false, return false.
|
||||
if ((0, _is.IsInteger)(this.$Realm, numericIndex) === false) return false;
|
||||
|
||||
// ii. If numericIndex = -0, return false.
|
||||
if (Object.is(numericIndex, -0)) return false;
|
||||
|
||||
// iii. If numericIndex < 0, return false.
|
||||
if (numericIndex < 0) return false;
|
||||
|
||||
// iv. Let length be O.[[ArrayLength]].
|
||||
var length = this.$ArrayLength;
|
||||
(0, _invariant2.default)(typeof length === "number");
|
||||
|
||||
// v. If numericIndex ≥ length, return false.
|
||||
if (numericIndex >= length) return false;
|
||||
|
||||
// vi. If IsAccessorDescriptor(Desc) is true, return false.
|
||||
if ((0, _is.IsAccessorDescriptor)(this.$Realm, Desc) === true) return false;
|
||||
|
||||
// vii. If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is true, return false.
|
||||
if (Desc.configurable === true) return false;
|
||||
|
||||
// viii. If Desc has an [[Enumerable]] field and if Desc.[[Enumerable]] is false, return false.
|
||||
if (Desc.enumerable === false) return false;
|
||||
|
||||
// ix. If Desc has a [[Writable]] field and if Desc.[[Writable]] is false, return false.
|
||||
if (Desc.writable === false) return false;
|
||||
|
||||
// x. If Desc has a [[Value]] field, then
|
||||
if (Desc.value) {
|
||||
// 1. Let value be Desc.[[Value]].
|
||||
var value = Desc.value;
|
||||
(0, _invariant2.default)(value === undefined || value instanceof _index.Value);
|
||||
|
||||
// 2. Return ? IntegerIndexedElementSet(O, numericIndex, value).
|
||||
return (0, _typedarray.IntegerIndexedElementSet)(this.$Realm, O, numericIndex, value);
|
||||
}
|
||||
|
||||
// xi. Return true.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Return ! OrdinaryDefineOwnProperty(O, P, Desc).
|
||||
return _singletons.Properties.OrdinaryDefineOwnProperty(this.$Realm, O, P, Desc);
|
||||
}
|
||||
|
||||
// ECMA262 9.4.5.4
|
||||
|
||||
}, {
|
||||
key: "$Get",
|
||||
value: function $Get(P, Receiver) {
|
||||
var O = this;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(this.$Realm, P), "IsPropertyKey(P) is true");
|
||||
|
||||
// 2. If Type(P) is String, then
|
||||
if (typeof P === "string" || P instanceof _index.StringValue) {
|
||||
// a. Let numericIndex be ! CanonicalNumericIndexString(P).
|
||||
var numericIndex = _singletons.To.CanonicalNumericIndexString(this.$Realm, typeof P === "string" ? new _index.StringValue(this.$Realm, P) : P);
|
||||
|
||||
// b. If numericIndex is not undefined, then
|
||||
if (numericIndex !== undefined) {
|
||||
// i. Return ? IntegerIndexedElementGet(O, numericIndex).
|
||||
return (0, _typedarray.IntegerIndexedElementGet)(this.$Realm, O, numericIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Return ? OrdinaryGet(O, P, Receiver).
|
||||
return (0, _get.OrdinaryGet)(this.$Realm, O, P, Receiver);
|
||||
}
|
||||
|
||||
// ECMA262 9.4.5.5
|
||||
|
||||
}, {
|
||||
key: "$Set",
|
||||
value: function $Set(P, V, Receiver) {
|
||||
var O = this;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(this.$Realm, P), "IsPropertyKey(P) is true");
|
||||
|
||||
// 2. If Type(P) is String, then
|
||||
if (typeof P === "string" || P instanceof _index.StringValue) {
|
||||
// a. Let numericIndex be ! CanonicalNumericIndexString(P).
|
||||
var numericIndex = _singletons.To.CanonicalNumericIndexString(this.$Realm, typeof P === "string" ? new _index.StringValue(this.$Realm, P) : P);
|
||||
|
||||
// b. If numericIndex is not undefined, then
|
||||
if (numericIndex !== undefined) {
|
||||
// i. Return ? IntegerIndexedElementSet(O, numericIndex, V).
|
||||
return (0, _typedarray.IntegerIndexedElementSet)(this.$Realm, O, numericIndex, V);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Return ? OrdinarySet(O, P, V, Receiver).
|
||||
return _singletons.Properties.OrdinarySet(this.$Realm, O, P, V, Receiver);
|
||||
}
|
||||
|
||||
// ECMA262 9.4.5.6
|
||||
|
||||
}, {
|
||||
key: "$OwnPropertyKeys",
|
||||
value: function $OwnPropertyKeys() {
|
||||
var _this2 = this;
|
||||
|
||||
var O = this;
|
||||
|
||||
// 1. Let keys be a new empty List.
|
||||
var keys = [];
|
||||
|
||||
// 2. Assert: O is an Object that has [[ViewedArrayBuffer]], [[ArrayLength]], [[ByteOffset]], and [[TypedArrayName]] internal slots.
|
||||
(0, _invariant2.default)(O instanceof _index.ObjectValue && O.$ViewedArrayBuffer && O.$ArrayLength !== undefined && O.$ByteOffset !== undefined && O.$TypedArrayName);
|
||||
|
||||
// 3. Let len be O.[[ArrayLength]].
|
||||
var len = O.$ArrayLength;
|
||||
(0, _invariant2.default)(typeof len === "number");
|
||||
|
||||
// 4. For each integer i starting with 0 such that i < len, in ascending order,
|
||||
for (var i = 0; i < len; ++i) {
|
||||
// a. Add ! ToString(i) as the last element of keys.
|
||||
keys.push(new _index.StringValue(this.$Realm, _singletons.To.ToString(this.$Realm, new _index.NumberValue(this.$Realm, i))));
|
||||
}
|
||||
|
||||
// 5. For each own property key P of O such that Type(P) is String and P is not an integer index, in ascending chronological order of property creation
|
||||
var properties = O.getOwnPropertyKeysArray();
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = properties.filter(function (x) {
|
||||
return !(0, _is.IsArrayIndex)(_this2.$Realm, x);
|
||||
})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var key = _step.value;
|
||||
|
||||
// i. Add P as the last element of keys.
|
||||
keys.push(new _index.StringValue(this.$Realm, key));
|
||||
}
|
||||
|
||||
// 6. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = O.symbols.keys()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var _key = _step2.value;
|
||||
|
||||
// a. Add P as the last element of keys.
|
||||
keys.push(_key);
|
||||
}
|
||||
|
||||
// 7. Return keys.
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
}]);
|
||||
|
||||
return IntegerIndexedExotic;
|
||||
}(_index.ObjectValue);
|
||||
|
||||
exports.default = IntegerIndexedExotic;
|
||||
//# sourceMappingURL=IntegerIndexedExotic.js.map
|
||||
1
build/node_modules/prepack/lib/values/IntegerIndexedExotic.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/IntegerIndexedExotic.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
121
build/node_modules/prepack/lib/values/NativeFunctionValue.js
generated
vendored
Normal file
121
build/node_modules/prepack/lib/values/NativeFunctionValue.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
"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 _completions = require("../completions.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/* Built-in Function Objects */
|
||||
var NativeFunctionValue = function (_ECMAScriptFunctionVa) {
|
||||
_inherits(NativeFunctionValue, _ECMAScriptFunctionVa);
|
||||
|
||||
function NativeFunctionValue(realm, intrinsicName, name, length, callback) {
|
||||
var constructor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
|
||||
|
||||
_classCallCheck(this, NativeFunctionValue);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (NativeFunctionValue.__proto__ || Object.getPrototypeOf(NativeFunctionValue)).call(this, realm, intrinsicName));
|
||||
|
||||
_this.$ThisMode = "strict";
|
||||
_this.$HomeObject = undefined;
|
||||
_this.$FunctionKind = "normal";
|
||||
|
||||
_this.$Call = function (thisArgument, argsList) {
|
||||
return _singletons.Functions.$Call(_this.$Realm, _this, thisArgument, argsList);
|
||||
};
|
||||
|
||||
if (constructor) {
|
||||
_this.$ConstructorKind = "base";
|
||||
_this.$Construct = function (argumentsList, newTarget) {
|
||||
return _singletons.Functions.$Construct(_this.$Realm, _this, argumentsList, newTarget);
|
||||
};
|
||||
}
|
||||
|
||||
_this.$Environment = realm.$GlobalEnv;
|
||||
|
||||
_this.callback = callback;
|
||||
_this.length = length;
|
||||
|
||||
_this.$DefineOwnProperty("length", {
|
||||
value: new _index.NumberValue(realm, length),
|
||||
writable: false,
|
||||
configurable: true,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
if (name) {
|
||||
if (name instanceof _index.SymbolValue) {
|
||||
_this.name = name.$Description ? "[" + name.$Description.throwIfNotConcreteString().value + "]" : "[native]";
|
||||
} else {
|
||||
_this.name = name;
|
||||
}
|
||||
_this.$DefineOwnProperty("name", {
|
||||
value: new _index.StringValue(realm, _this.name),
|
||||
writable: false,
|
||||
configurable: true,
|
||||
enumerable: false
|
||||
});
|
||||
} else {
|
||||
_this.name = "native";
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(NativeFunctionValue, [{
|
||||
key: "getTrackedPropertyNames",
|
||||
value: function getTrackedPropertyNames() {
|
||||
return NativeFunctionValue.trackedPropertyNames;
|
||||
}
|
||||
}, {
|
||||
key: "hasDefaultLength",
|
||||
value: function hasDefaultLength() {
|
||||
return this.getLength() === this.length;
|
||||
}
|
||||
}, {
|
||||
key: "getName",
|
||||
|
||||
|
||||
// Override.
|
||||
value: function getName() {
|
||||
return this.name;
|
||||
}
|
||||
}, {
|
||||
key: "callCallback",
|
||||
value: function callCallback(context, argsList, newTarget) {
|
||||
var originalLength = argsList.length;
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
argsList[i] = argsList[i] || this.$Realm.intrinsics.undefined;
|
||||
}
|
||||
return new _completions.ReturnCompletion(this.callback(context, argsList, originalLength, newTarget), this.$Realm.currentLocation);
|
||||
}
|
||||
|
||||
// for Proxy
|
||||
|
||||
}]);
|
||||
|
||||
return NativeFunctionValue;
|
||||
}(_index.ECMAScriptFunctionValue);
|
||||
|
||||
NativeFunctionValue.trackedPropertyNames = _index.ObjectValue.trackedPropertyNames.concat("$RevocableProxy");
|
||||
exports.default = NativeFunctionValue;
|
||||
//# sourceMappingURL=NativeFunctionValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/NativeFunctionValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/NativeFunctionValue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
64
build/node_modules/prepack/lib/values/NullValue.js
generated
vendored
Normal file
64
build/node_modules/prepack/lib/values/NullValue.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"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");
|
||||
|
||||
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 NullValue = function (_PrimitiveValue) {
|
||||
_inherits(NullValue, _PrimitiveValue);
|
||||
|
||||
function NullValue() {
|
||||
_classCallCheck(this, NullValue);
|
||||
|
||||
return _possibleConstructorReturn(this, (NullValue.__proto__ || Object.getPrototypeOf(NullValue)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(NullValue, [{
|
||||
key: "_serialize",
|
||||
value: function _serialize() {
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof NullValue;
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
return 5613143836447527;
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "toDisplayValue",
|
||||
value: function toDisplayValue() {
|
||||
return "null";
|
||||
}
|
||||
}]);
|
||||
|
||||
return NullValue;
|
||||
}(_index.PrimitiveValue);
|
||||
|
||||
exports.default = NullValue;
|
||||
//# sourceMappingURL=NullValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/NullValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/NullValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/NullValue.js"],"names":["NullValue","x"],"mappings":";;;;;;;;AAWA;;;;;;+eAXA;;;;;;;;;IAaqBA,S;;;;;;;;;;;iCACA;AACjB,aAAO,IAAP;AACD;;;2BAEMC,C,EAAmB;AACxB,aAAOA,aAAaD,SAApB;AACD;;;8BAEiB;AAChB,aAAO,gBAAP;AACD;;;mCAEuB;AACtB,aAAO,IAAP;AACD;;;qCAEwB;AACvB,aAAO,MAAP;AACD;;;;;;kBAnBkBA,S","file":"NullValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { PrimitiveValue, Value } from \"./index.js\";\n\nexport default class NullValue extends PrimitiveValue {\n _serialize(): null {\n return null;\n }\n\n equals(x: Value): boolean {\n return x instanceof NullValue;\n }\n\n getHash(): number {\n return 5613143836447527;\n }\n\n mightBeFalse(): boolean {\n return true;\n }\n\n toDisplayValue(): string {\n return \"null\";\n }\n}\n"]}
|
||||
74
build/node_modules/prepack/lib/values/NumberValue.js
generated
vendored
Normal file
74
build/node_modules/prepack/lib/values/NumberValue.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"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");
|
||||
|
||||
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 NumberValue = function (_PrimitiveValue) {
|
||||
_inherits(NumberValue, _PrimitiveValue);
|
||||
|
||||
function NumberValue(realm, value, intrinsicName) {
|
||||
_classCallCheck(this, NumberValue);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (NumberValue.__proto__ || Object.getPrototypeOf(NumberValue)).call(this, realm, intrinsicName));
|
||||
|
||||
_this.value = value;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(NumberValue, [{
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof NumberValue && this.value === x.value;
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
var num = Math.abs(this.value);
|
||||
if (num < 100) num *= 10000000;
|
||||
return num | 0; // make a 32-bit integer out of this and get rid of NaN
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
return this.value === 0 || isNaN(this.value);
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteNumber",
|
||||
value: function throwIfNotConcreteNumber() {
|
||||
return this;
|
||||
}
|
||||
}, {
|
||||
key: "_serialize",
|
||||
value: function _serialize() {
|
||||
return this.value;
|
||||
}
|
||||
}, {
|
||||
key: "toDisplayString",
|
||||
value: function toDisplayString() {
|
||||
return this.value.toString();
|
||||
}
|
||||
}]);
|
||||
|
||||
return NumberValue;
|
||||
}(_index.PrimitiveValue);
|
||||
|
||||
exports.default = NumberValue;
|
||||
//# sourceMappingURL=NumberValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/NumberValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/NumberValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/NumberValue.js"],"names":["NumberValue","realm","value","intrinsicName","x","num","Math","abs","isNaN","toString"],"mappings":";;;;;;;;AAWA;;;;;;+eAXA;;;;;;;;;IAcqBA,W;;;AACnB,uBAAYC,KAAZ,EAA0BC,KAA1B,EAAyCC,aAAzC,EAAiE;AAAA;;AAAA,0HACzDF,KADyD,EAClDE,aADkD;;AAG/D,UAAKD,KAAL,GAAaA,KAAb;AAH+D;AAIhE;;;;2BAIME,C,EAAmB;AACxB,aAAOA,aAAaJ,WAAb,IAA4B,KAAKE,KAAL,KAAeE,EAAEF,KAApD;AACD;;;8BAEiB;AAChB,UAAIG,MAAMC,KAAKC,GAAL,CAAS,KAAKL,KAAd,CAAV;AACA,UAAIG,MAAM,GAAV,EAAeA,OAAO,QAAP;AACf,aAAOA,MAAM,CAAb,CAHgB,CAGA;AACjB;;;mCAEuB;AACtB,aAAO,KAAKH,KAAL,KAAe,CAAf,IAAoBM,MAAM,KAAKN,KAAX,CAA3B;AACD;;;+CAEuC;AACtC,aAAO,IAAP;AACD;;;iCAEoB;AACnB,aAAO,KAAKA,KAAZ;AACD;;;sCAEyB;AACxB,aAAO,KAAKA,KAAL,CAAWO,QAAX,EAAP;AACD;;;;;;kBAjCkBT,W","file":"NumberValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { PrimitiveValue, Value } from \"./index.js\";\nimport type { Realm } from \"../realm.js\";\n\nexport default class NumberValue extends PrimitiveValue {\n constructor(realm: Realm, value: number, intrinsicName?: string) {\n super(realm, intrinsicName);\n\n this.value = value;\n }\n\n value: number;\n\n equals(x: Value): boolean {\n return x instanceof NumberValue && this.value === x.value;\n }\n\n getHash(): number {\n let num = Math.abs(this.value);\n if (num < 100) num *= 10000000;\n return num | 0; // make a 32-bit integer out of this and get rid of NaN\n }\n\n mightBeFalse(): boolean {\n return this.value === 0 || isNaN(this.value);\n }\n\n throwIfNotConcreteNumber(): NumberValue {\n return this;\n }\n\n _serialize(): number {\n return this.value;\n }\n\n toDisplayString(): string {\n return this.value.toString();\n }\n}\n"]}
|
||||
894
build/node_modules/prepack/lib/values/ObjectValue.js
generated
vendored
Normal file
894
build/node_modules/prepack/lib/values/ObjectValue.js
generated
vendored
Normal file
@@ -0,0 +1,894 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
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 _errors = require("../errors.js");
|
||||
|
||||
var _index = require("./index.js");
|
||||
|
||||
var _utils = require("../react/utils.js");
|
||||
|
||||
var _index2 = require("../methods/index.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
function isWidenedValue(v) {
|
||||
if (!(v instanceof _index.AbstractValue)) return false;
|
||||
if (v.kind === "widened" || v.kind === "widened property") return true;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = v.args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var a = _step.value;
|
||||
|
||||
if (isWidenedValue(a)) return true;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var ObjectValue = function (_ConcreteValue) {
|
||||
_inherits(ObjectValue, _ConcreteValue);
|
||||
|
||||
function ObjectValue(realm, proto, intrinsicName) {
|
||||
var refuseSerialization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
|
||||
_classCallCheck(this, ObjectValue);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (ObjectValue.__proto__ || Object.getPrototypeOf(ObjectValue)).call(this, realm, intrinsicName));
|
||||
|
||||
realm.recordNewObject(_this);
|
||||
if (realm.useAbstractInterpretation) _this.setupBindings(_this.getTrackedPropertyNames());
|
||||
_this.$Prototype = proto || realm.intrinsics.null;
|
||||
_this.$Extensible = realm.intrinsics.true;
|
||||
_this._isPartial = realm.intrinsics.false;
|
||||
_this._hasLeaked = realm.intrinsics.false;
|
||||
_this._isSimple = realm.intrinsics.false;
|
||||
_this.properties = new Map();
|
||||
_this.symbols = new Map();
|
||||
_this.refuseSerialization = refuseSerialization;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(ObjectValue, [{
|
||||
key: "getTrackedPropertyNames",
|
||||
value: function getTrackedPropertyNames() {
|
||||
return ObjectValue.trackedPropertyNames;
|
||||
}
|
||||
}, {
|
||||
key: "setupBindings",
|
||||
value: function setupBindings(propertyNames) {
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = propertyNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var propName = _step2.value;
|
||||
|
||||
var desc = { writeable: true, value: undefined };
|
||||
this[propName + "_binding"] = {
|
||||
descriptor: desc,
|
||||
object: this,
|
||||
key: propName
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof ObjectValue && this.getHash() === x.getHash();
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
if (!this.hashValue) {
|
||||
this.hashValue = ++this.$Realm.objectCount;
|
||||
}
|
||||
return this.hashValue;
|
||||
}
|
||||
|
||||
// We track some internal state as properties on the global object, these should
|
||||
// never be serialized.
|
||||
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeObject",
|
||||
value: function mightNotBeObject() {
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotObject",
|
||||
value: function throwIfNotObject() {
|
||||
return this;
|
||||
}
|
||||
}, {
|
||||
key: "makeNotPartial",
|
||||
value: function makeNotPartial() {
|
||||
this._isPartial = this.$Realm.intrinsics.false;
|
||||
}
|
||||
}, {
|
||||
key: "makePartial",
|
||||
value: function makePartial() {
|
||||
this._isPartial = this.$Realm.intrinsics.true;
|
||||
}
|
||||
}, {
|
||||
key: "makeSimple",
|
||||
value: function makeSimple() {
|
||||
this._isSimple = this.$Realm.intrinsics.true;
|
||||
}
|
||||
}, {
|
||||
key: "isPartialObject",
|
||||
value: function isPartialObject() {
|
||||
return this._isPartial.value;
|
||||
}
|
||||
}, {
|
||||
key: "leak",
|
||||
value: function leak() {
|
||||
this._hasLeaked = this.$Realm.intrinsics.true;
|
||||
}
|
||||
}, {
|
||||
key: "isLeakedObject",
|
||||
value: function isLeakedObject() {
|
||||
if (this._hasLeaked instanceof _index.BooleanValue) {
|
||||
return this._hasLeaked.value;
|
||||
}
|
||||
if (this._hasLeaked === undefined) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "isSimpleObject",
|
||||
value: function isSimpleObject() {
|
||||
if (this._isSimple.value) return true;
|
||||
if (this.isPartialObject()) return false;
|
||||
if (this.symbols.size > 0) return false;
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = this.properties.values()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var propertyBinding = _step3.value;
|
||||
|
||||
var desc = propertyBinding.descriptor;
|
||||
if (desc === undefined) continue; // deleted
|
||||
if (!(0, _index2.IsDataDescriptor)(this.$Realm, desc)) return false;
|
||||
if (!desc.writable) return false;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.$Prototype instanceof _index.NullValue) return true;
|
||||
if (this.$Prototype === this.$Realm.intrinsics.ObjectPrototype) return true;
|
||||
return this.$Prototype.isSimpleObject();
|
||||
}
|
||||
}, {
|
||||
key: "getExtensible",
|
||||
value: function getExtensible() {
|
||||
return this.$Extensible.value;
|
||||
}
|
||||
}, {
|
||||
key: "setExtensible",
|
||||
value: function setExtensible(v) {
|
||||
this.$Extensible = v ? this.$Realm.intrinsics.true : this.$Realm.intrinsics.false;
|
||||
}
|
||||
}, {
|
||||
key: "getKind",
|
||||
value: function getKind() {
|
||||
// we can deduce the natural prototype by checking whether the following internal slots are present
|
||||
if (this.$SymbolData !== undefined) return "Symbol";
|
||||
if (this.$StringData !== undefined) return "String";
|
||||
if (this.$NumberData !== undefined) return "Number";
|
||||
if (this.$BooleanData !== undefined) return "Boolean";
|
||||
if (this.$DateValue !== undefined) return "Date";
|
||||
if (this.$RegExpMatcher !== undefined) return "RegExp";
|
||||
if (this.$SetData !== undefined) return "Set";
|
||||
if (this.$MapData !== undefined) return "Map";
|
||||
if (this.$DataView !== undefined) return "DataView";
|
||||
if (this.$ArrayBufferData !== undefined) return "ArrayBuffer";
|
||||
if (this.$WeakMapData !== undefined) return "WeakMap";
|
||||
if (this.$WeakSetData !== undefined) return "WeakSet";
|
||||
if ((0, _utils.isReactElement)(this) && this.$Realm.react.enabled) return "ReactElement";
|
||||
if (this.$TypedArrayName !== undefined) return this.$TypedArrayName;
|
||||
// TODO #26 #712: Promises. All kinds of iterators. Generators.
|
||||
return "Object";
|
||||
}
|
||||
}, {
|
||||
key: "defineNativeMethod",
|
||||
value: function defineNativeMethod(name, length, callback) {
|
||||
var desc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
|
||||
var intrinsicName = void 0;
|
||||
if (typeof name === "string") {
|
||||
if (this.intrinsicName) intrinsicName = this.intrinsicName + "." + name;
|
||||
} else if (name instanceof _index.SymbolValue) {
|
||||
if (this.intrinsicName && name.intrinsicName) intrinsicName = this.intrinsicName + "[" + name.intrinsicName + "]";
|
||||
} else {
|
||||
(0, _invariant2.default)(false);
|
||||
}
|
||||
this.defineNativeProperty(name, new _index.NativeFunctionValue(this.$Realm, intrinsicName, name, length, callback, false), desc);
|
||||
}
|
||||
}, {
|
||||
key: "defineNativeProperty",
|
||||
value: function defineNativeProperty(name, value) {
|
||||
var desc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
(0, _invariant2.default)(!value || value instanceof _index.Value);
|
||||
this.$DefineOwnProperty(name, _extends({
|
||||
value: value,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}, desc));
|
||||
}
|
||||
}, {
|
||||
key: "defineNativeGetter",
|
||||
value: function defineNativeGetter(name, callback) {
|
||||
var desc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
var intrinsicName = void 0,
|
||||
funcName = void 0;
|
||||
if (typeof name === "string") {
|
||||
funcName = "get " + name;
|
||||
if (this.intrinsicName) intrinsicName = this.intrinsicName + "." + name;
|
||||
} else if (name instanceof _index.SymbolValue) {
|
||||
funcName = name.$Description instanceof _index.Value ? "get [" + name.$Description.throwIfNotConcreteString().value + "]" : "get [" + "?" + "]";
|
||||
if (this.intrinsicName && name.intrinsicName) intrinsicName = this.intrinsicName + "[" + name.intrinsicName + "]";
|
||||
} else {
|
||||
(0, _invariant2.default)(false);
|
||||
}
|
||||
|
||||
var func = new _index.NativeFunctionValue(this.$Realm, intrinsicName, funcName, 0, callback);
|
||||
this.$DefineOwnProperty(name, _extends({
|
||||
get: func,
|
||||
set: this.$Realm.intrinsics.undefined,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
}, desc));
|
||||
}
|
||||
}, {
|
||||
key: "defineNativeConstant",
|
||||
value: function defineNativeConstant(name, value) {
|
||||
var desc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
(0, _invariant2.default)(!value || value instanceof _index.Value);
|
||||
this.$DefineOwnProperty(name, _extends({
|
||||
value: value,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
}, desc));
|
||||
}
|
||||
}, {
|
||||
key: "getOwnPropertyKeysArray",
|
||||
value: function getOwnPropertyKeysArray() {
|
||||
var _this2 = this;
|
||||
|
||||
if (this.isPartialObject() || this.isLeakedObject() || this.unknownProperty !== undefined) {
|
||||
_index.AbstractValue.reportIntrospectionError(this);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
|
||||
var keyArray = Array.from(this.properties.keys());
|
||||
keyArray = keyArray.filter(function (x) {
|
||||
var pb = _this2.properties.get(x);
|
||||
if (!pb || pb.descriptor === undefined) return false;
|
||||
var pv = pb.descriptor.value;
|
||||
if (pv === undefined) return true;
|
||||
(0, _invariant2.default)(pv instanceof _index.Value);
|
||||
if (!pv.mightHaveBeenDeleted()) return true;
|
||||
// The property may or may not be there at runtime.
|
||||
// We can at best return an abstract keys array.
|
||||
// For now just terminate.
|
||||
(0, _invariant2.default)(pv instanceof _index.AbstractValue);
|
||||
_index.AbstractValue.reportIntrospectionError(pv);
|
||||
throw new _errors.FatalError();
|
||||
});
|
||||
this.$Realm.callReportObjectGetOwnProperties(this);
|
||||
return keyArray;
|
||||
}
|
||||
}, {
|
||||
key: "_serialize",
|
||||
value: function _serialize(set, stack) {
|
||||
var obj = set({});
|
||||
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator4 = this.properties[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
||||
var _ref = _step4.value;
|
||||
|
||||
var _ref2 = _slicedToArray(_ref, 2);
|
||||
|
||||
var key = _ref2[0];
|
||||
var propertyBinding = _ref2[1];
|
||||
|
||||
var desc = propertyBinding.descriptor;
|
||||
if (desc === undefined) continue; // deleted
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(desc.value);
|
||||
var serializedDesc = { enumerable: desc.enumerable, configurable: desc.configurable };
|
||||
if (desc.value) {
|
||||
serializedDesc.writable = desc.writable;
|
||||
(0, _invariant2.default)(desc.value instanceof _index.Value);
|
||||
serializedDesc.value = desc.value.serialize(stack);
|
||||
} else {
|
||||
(0, _invariant2.default)(desc.get !== undefined);
|
||||
serializedDesc.get = desc.get.serialize(stack);
|
||||
(0, _invariant2.default)(desc.set !== undefined);
|
||||
serializedDesc.set = desc.set.serialize(stack);
|
||||
}
|
||||
Object.defineProperty(obj, key, serializedDesc);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
// ECMA262 9.1.1
|
||||
|
||||
}, {
|
||||
key: "$GetPrototypeOf",
|
||||
value: function $GetPrototypeOf() {
|
||||
return this.$Prototype;
|
||||
}
|
||||
|
||||
// ECMA262 9.1.2
|
||||
|
||||
}, {
|
||||
key: "$SetPrototypeOf",
|
||||
value: function $SetPrototypeOf(V) {
|
||||
// 1. Return ! OrdinarySetPrototypeOf(O, V).
|
||||
return _singletons.Properties.OrdinarySetPrototypeOf(this.$Realm, this, V);
|
||||
}
|
||||
|
||||
// ECMA262 9.1.3
|
||||
|
||||
}, {
|
||||
key: "$IsExtensible",
|
||||
value: function $IsExtensible() {
|
||||
// 1. Return ! OrdinaryIsExtensible(O).
|
||||
return (0, _index2.OrdinaryIsExtensible)(this.$Realm, this);
|
||||
}
|
||||
|
||||
// ECMA262 9.1.4
|
||||
|
||||
}, {
|
||||
key: "$PreventExtensions",
|
||||
value: function $PreventExtensions() {
|
||||
// 1. Return ! OrdinaryPreventExtensions(O).
|
||||
return (0, _index2.OrdinaryPreventExtensions)(this.$Realm, this);
|
||||
}
|
||||
|
||||
// ECMA262 9.1.5
|
||||
|
||||
}, {
|
||||
key: "$GetOwnProperty",
|
||||
value: function $GetOwnProperty(P) {
|
||||
// 1. Return ! OrdinaryGetOwnProperty(O, P).
|
||||
return _singletons.Properties.OrdinaryGetOwnProperty(this.$Realm, this, P);
|
||||
}
|
||||
|
||||
// ECMA262 9.1.6
|
||||
|
||||
}, {
|
||||
key: "$DefineOwnProperty",
|
||||
value: function $DefineOwnProperty(P, Desc) {
|
||||
// 1. Return ? OrdinaryDefineOwnProperty(O, P, Desc).
|
||||
return _singletons.Properties.OrdinaryDefineOwnProperty(this.$Realm, this, P, Desc);
|
||||
}
|
||||
|
||||
// ECMA262 9.1.7
|
||||
|
||||
}, {
|
||||
key: "$HasProperty",
|
||||
value: function $HasProperty(P) {
|
||||
if (this.unknownProperty !== undefined && this.$GetOwnProperty(P) === undefined) {
|
||||
_index.AbstractValue.reportIntrospectionError(this, P);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
|
||||
return (0, _index2.OrdinaryHasProperty)(this.$Realm, this, P);
|
||||
}
|
||||
|
||||
// ECMA262 9.1.8
|
||||
|
||||
}, {
|
||||
key: "$Get",
|
||||
value: function $Get(P, Receiver) {
|
||||
var prop = this.unknownProperty;
|
||||
if (prop !== undefined && prop.descriptor !== undefined && this.$GetOwnProperty(P) === undefined) {
|
||||
var desc = prop.descriptor;
|
||||
(0, _invariant2.default)(desc !== undefined);
|
||||
var val = desc.value;
|
||||
(0, _invariant2.default)(val instanceof _index.AbstractValue);
|
||||
var propName = void 0;
|
||||
if (P instanceof _index.StringValue) {
|
||||
propName = P;
|
||||
} else if (typeof P === "string") {
|
||||
propName = new _index.StringValue(this.$Realm, P);
|
||||
} else {
|
||||
_index.AbstractValue.reportIntrospectionError(val, "abstract computed property name");
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
return this.specializeJoin(val, propName);
|
||||
}
|
||||
|
||||
// 1. Return ? OrdinaryGet(O, P, Receiver).
|
||||
return (0, _index2.OrdinaryGet)(this.$Realm, this, P, Receiver);
|
||||
}
|
||||
}, {
|
||||
key: "$GetPartial",
|
||||
value: function $GetPartial(P, Receiver) {
|
||||
if (!(P instanceof _index.AbstractValue)) return this.$Get(P, Receiver);
|
||||
// We assume that simple objects have no getter/setter properties.
|
||||
if (this !== Receiver || !this.isSimpleObject() || P.mightNotBeString() && P.mightNotBeNumber()) {
|
||||
_index.AbstractValue.reportIntrospectionError(P, "TODO: #1021");
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
// If all else fails, use this expression
|
||||
var result = void 0;
|
||||
if (this.isPartialObject()) {
|
||||
if (isWidenedValue(P)) {
|
||||
return _index.AbstractValue.createTemporalFromBuildFunction(this.$Realm, _index.Value, [this, P], function (_ref3) {
|
||||
var _ref4 = _slicedToArray(_ref3, 2),
|
||||
o = _ref4[0],
|
||||
p = _ref4[1];
|
||||
|
||||
return t.memberExpression(o, p, true);
|
||||
});
|
||||
}
|
||||
result = _index.AbstractValue.createFromType(this.$Realm, _index.Value, "sentinel member expression");
|
||||
result.args = [this, P];
|
||||
} else {
|
||||
result = this.$Realm.intrinsics.undefined;
|
||||
}
|
||||
// Get a specialization of the join of all values written to the object
|
||||
// with abstract property names.
|
||||
var prop = this.unknownProperty;
|
||||
if (prop !== undefined) {
|
||||
var desc = prop.descriptor;
|
||||
if (desc !== undefined) {
|
||||
var val = desc.value;
|
||||
(0, _invariant2.default)(val instanceof _index.AbstractValue);
|
||||
result = this.specializeJoin(val, P);
|
||||
}
|
||||
}
|
||||
// Join in all of the other values that were written to the object with
|
||||
// concrete property names.
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator5 = this.properties[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
||||
var _ref5 = _step5.value;
|
||||
|
||||
var _ref6 = _slicedToArray(_ref5, 2);
|
||||
|
||||
var key = _ref6[0];
|
||||
var propertyBinding = _ref6[1];
|
||||
|
||||
var _desc = propertyBinding.descriptor;
|
||||
if (_desc === undefined) continue; // deleted
|
||||
(0, _invariant2.default)(_desc.value !== undefined); // otherwise this is not simple
|
||||
var _val = _desc.value;
|
||||
(0, _invariant2.default)(_val instanceof _index.Value);
|
||||
var cond = _index.AbstractValue.createFromBinaryOp(this.$Realm, "===", P, new _index.StringValue(this.$Realm, key), undefined, "check for known property");
|
||||
result = _singletons.Join.joinValuesAsConditional(this.$Realm, cond, _val, result);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "specializeJoin",
|
||||
value: function specializeJoin(absVal, propName) {
|
||||
if (absVal.kind === "widened property") {
|
||||
var ob = absVal.args[0];
|
||||
if (propName instanceof _index.StringValue) {
|
||||
var pName = propName.value;
|
||||
var pNumber = +pName;
|
||||
if (pName === pNumber + "") propName = new _index.NumberValue(this.$Realm, pNumber);
|
||||
}
|
||||
return _index.AbstractValue.createTemporalFromBuildFunction(this.$Realm, absVal.getType(), [ob, propName], function (_ref7) {
|
||||
var _ref8 = _slicedToArray(_ref7, 2),
|
||||
o = _ref8[0],
|
||||
p = _ref8[1];
|
||||
|
||||
return t.memberExpression(o, p, true);
|
||||
});
|
||||
}
|
||||
(0, _invariant2.default)(absVal.args.length === 3 && absVal.kind === "conditional");
|
||||
var generic_cond = absVal.args[0];
|
||||
(0, _invariant2.default)(generic_cond instanceof _index.AbstractValue);
|
||||
var cond = this.specializeCond(generic_cond, propName);
|
||||
var arg1 = absVal.args[1];
|
||||
if (arg1 instanceof _index.AbstractValue && arg1.args.length === 3) arg1 = this.specializeJoin(arg1, propName);
|
||||
var arg2 = absVal.args[2];
|
||||
if (arg2 instanceof _index.AbstractValue && arg2.args.length === 3) arg2 = this.specializeJoin(arg2, propName);
|
||||
return _index.AbstractValue.createFromConditionalOp(this.$Realm, cond, arg1, arg2, absVal.expressionLocation);
|
||||
}
|
||||
}, {
|
||||
key: "specializeCond",
|
||||
value: function specializeCond(absVal, propName) {
|
||||
if (absVal.kind === "template for property name condition") return _index.AbstractValue.createFromBinaryOp(this.$Realm, "===", absVal.args[0], propName);
|
||||
return absVal;
|
||||
}
|
||||
|
||||
// ECMA262 9.1.9
|
||||
|
||||
}, {
|
||||
key: "$Set",
|
||||
value: function $Set(P, V, Receiver) {
|
||||
// 1. Return ? OrdinarySet(O, P, V, Receiver).
|
||||
return _singletons.Properties.OrdinarySet(this.$Realm, this, P, V, Receiver);
|
||||
}
|
||||
}, {
|
||||
key: "$SetPartial",
|
||||
value: function $SetPartial(P, V, Receiver) {
|
||||
if (!(P instanceof _index.AbstractValue)) return this.$Set(P, V, Receiver);
|
||||
var pIsLoopVar = isWidenedValue(P);
|
||||
var pIsNumeric = _index.Value.isTypeCompatibleWith(P.getType(), _index.NumberValue);
|
||||
|
||||
function createTemplate(realm, propName) {
|
||||
return _index.AbstractValue.createFromBinaryOp(realm, "===", propName, new _index.StringValue(realm, ""), undefined, "template for property name condition");
|
||||
}
|
||||
|
||||
// We assume that simple objects have no getter/setter properties and
|
||||
// that all properties are writable.
|
||||
if (this !== Receiver || !this.isSimpleObject() || P.mightNotBeString() && P.mightNotBeNumber()) {
|
||||
_index.AbstractValue.reportIntrospectionError(P, "TODO #1021");
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
|
||||
var prop = void 0;
|
||||
if (this.unknownProperty === undefined) {
|
||||
prop = {
|
||||
descriptor: undefined,
|
||||
object: this,
|
||||
key: P
|
||||
};
|
||||
this.unknownProperty = prop;
|
||||
} else {
|
||||
prop = this.unknownProperty;
|
||||
}
|
||||
this.$Realm.recordModifiedProperty(prop);
|
||||
var desc = prop.descriptor;
|
||||
if (desc === undefined) {
|
||||
var newVal = V;
|
||||
if (!(V instanceof _index.UndefinedValue) && !isWidenedValue(P)) {
|
||||
// join V with undefined, using a property name test as the condition
|
||||
var cond = createTemplate(this.$Realm, P);
|
||||
newVal = _singletons.Join.joinValuesAsConditional(this.$Realm, cond, V, this.$Realm.intrinsics.undefined);
|
||||
}
|
||||
prop.descriptor = {
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: newVal
|
||||
};
|
||||
} else {
|
||||
// join V with current value of this.unknownProperty. I.e. weak update.
|
||||
var oldVal = desc.value;
|
||||
(0, _invariant2.default)(oldVal instanceof _index.Value);
|
||||
var _newVal = oldVal;
|
||||
if (!(V instanceof _index.UndefinedValue)) {
|
||||
if (isWidenedValue(P)) {
|
||||
_newVal = V; // It will be widened later on
|
||||
} else {
|
||||
var _cond = createTemplate(this.$Realm, P);
|
||||
_newVal = _singletons.Join.joinValuesAsConditional(this.$Realm, _cond, V, oldVal);
|
||||
}
|
||||
}
|
||||
desc.value = _newVal;
|
||||
}
|
||||
|
||||
// Since we don't know the name of the property we are writing to, we also need
|
||||
// to perform weak updates of all of the known properties.
|
||||
// First clear out this.unknownProperty so that helper routines know its OK to update the properties
|
||||
var savedUnknownProperty = this.unknownProperty;
|
||||
this.unknownProperty = undefined;
|
||||
var _iteratorNormalCompletion6 = true;
|
||||
var _didIteratorError6 = false;
|
||||
var _iteratorError6 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator6 = this.properties[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
||||
var _ref9 = _step6.value;
|
||||
|
||||
var _ref10 = _slicedToArray(_ref9, 2);
|
||||
|
||||
var key = _ref10[0];
|
||||
var propertyBinding = _ref10[1];
|
||||
|
||||
if (pIsLoopVar && pIsNumeric) {
|
||||
// Delete numeric properties and don't do weak updates on other properties.
|
||||
if (key !== +key + "") continue;
|
||||
this.properties.delete(key);
|
||||
continue;
|
||||
}
|
||||
var _oldVal = this.$Realm.intrinsics.empty;
|
||||
if (propertyBinding.descriptor && propertyBinding.descriptor.value) {
|
||||
_oldVal = propertyBinding.descriptor.value;
|
||||
(0, _invariant2.default)(_oldVal instanceof _index.Value); // otherwise this is not simple
|
||||
}
|
||||
var _cond2 = _index.AbstractValue.createFromBinaryOp(this.$Realm, "===", P, new _index.StringValue(this.$Realm, key));
|
||||
var _newVal2 = _singletons.Join.joinValuesAsConditional(this.$Realm, _cond2, V, _oldVal);
|
||||
_singletons.Properties.OrdinarySet(this.$Realm, this, key, _newVal2, Receiver);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError6 = true;
|
||||
_iteratorError6 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion6 && _iterator6.return) {
|
||||
_iterator6.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError6) {
|
||||
throw _iteratorError6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.unknownProperty = savedUnknownProperty;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ECMA262 9.1.10
|
||||
|
||||
}, {
|
||||
key: "$Delete",
|
||||
value: function $Delete(P) {
|
||||
if (this.unknownProperty !== undefined) {
|
||||
// TODO #946: generate a delete from the object
|
||||
_index.AbstractValue.reportIntrospectionError(this, P);
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
|
||||
// 1. Return ? OrdinaryDelete(O, P).
|
||||
return _singletons.Properties.OrdinaryDelete(this.$Realm, this, P);
|
||||
}
|
||||
|
||||
// ECMA262 9.1.11
|
||||
|
||||
}, {
|
||||
key: "$OwnPropertyKeys",
|
||||
value: function $OwnPropertyKeys() {
|
||||
return (0, _index2.OrdinaryOwnPropertyKeys)(this.$Realm, this);
|
||||
}
|
||||
}], [{
|
||||
key: "setupTrackedPropertyAccessors",
|
||||
value: function setupTrackedPropertyAccessors(propertyNames) {
|
||||
var _loop = function _loop(propName) {
|
||||
Object.defineProperty(ObjectValue.prototype, propName, {
|
||||
configurable: true,
|
||||
get: function get() {
|
||||
var binding = this[propName + "_binding"];
|
||||
return binding.descriptor.value;
|
||||
},
|
||||
set: function set(v) {
|
||||
(0, _invariant2.default)(!this.isLeakedObject(), "cannot mutate a leaked object");
|
||||
var binding = this[propName + "_binding"];
|
||||
this.$Realm.recordModifiedProperty(binding);
|
||||
binding.descriptor.value = v;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var _iteratorNormalCompletion7 = true;
|
||||
var _didIteratorError7 = false;
|
||||
var _iteratorError7 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator7 = propertyNames[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
||||
var propName = _step7.value;
|
||||
|
||||
_loop(propName);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError7 = true;
|
||||
_iteratorError7 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion7 && _iterator7.return) {
|
||||
_iterator7.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError7) {
|
||||
throw _iteratorError7;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // undefined when the property is "missing"
|
||||
|
||||
|
||||
// error
|
||||
|
||||
|
||||
// function
|
||||
|
||||
|
||||
// promise
|
||||
|
||||
|
||||
// iterator
|
||||
|
||||
|
||||
// set
|
||||
|
||||
|
||||
// react
|
||||
|
||||
|
||||
// map
|
||||
|
||||
|
||||
// weak map
|
||||
|
||||
|
||||
// weak set
|
||||
|
||||
|
||||
// date
|
||||
// of type number
|
||||
|
||||
// array
|
||||
|
||||
|
||||
// regex
|
||||
|
||||
|
||||
// string
|
||||
|
||||
|
||||
// data view
|
||||
|
||||
|
||||
// array buffer
|
||||
|
||||
|
||||
// generator
|
||||
|
||||
|
||||
// typed array
|
||||
|
||||
|
||||
// backpointer to the constructor if this object was created its prototype object
|
||||
|
||||
|
||||
// partial objects
|
||||
|
||||
|
||||
// tainted objects
|
||||
|
||||
|
||||
// If true, the object has no property getters or setters and it is safe
|
||||
// to return AbstractValue for unknown properties.
|
||||
|
||||
|
||||
// An object value with an intrinsic name can either exist from the beginning of time,
|
||||
// or it can be associated with a particular point in time by being used as a template
|
||||
// when deriving an abstract value via a generator.
|
||||
|
||||
|
||||
// ReactElement
|
||||
|
||||
}]);
|
||||
|
||||
return ObjectValue;
|
||||
}(_index.ConcreteValue);
|
||||
|
||||
ObjectValue.trackedPropertyNames = ["_isPartial", "_hasLeaked", "_isSimple", "$ArrayIteratorNextIndex", "$DateValue", "$Extensible", "$IteratedList", "$IteratedObject", "$IteratedSet", "$IteratedString", "$Map", "$MapData", "$MapNextIndex", "$Prototype", "$SetData", "$SetNextIndex", "$StringIteratorNextIndex", "$WeakMapData", "$WeakSetData"];
|
||||
exports.default = ObjectValue;
|
||||
//# sourceMappingURL=ObjectValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/ObjectValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/ObjectValue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
56
build/node_modules/prepack/lib/values/PrimitiveValue.js
generated
vendored
Normal file
56
build/node_modules/prepack/lib/values/PrimitiveValue.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"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 PrimitiveValue = function (_ConcreteValue) {
|
||||
_inherits(PrimitiveValue, _ConcreteValue);
|
||||
|
||||
function PrimitiveValue(realm, intrinsicName) {
|
||||
_classCallCheck(this, PrimitiveValue);
|
||||
|
||||
(0, _invariant2.default)(realm, "realm required");
|
||||
return _possibleConstructorReturn(this, (PrimitiveValue.__proto__ || Object.getPrototypeOf(PrimitiveValue)).call(this, realm, intrinsicName));
|
||||
}
|
||||
|
||||
_createClass(PrimitiveValue, [{
|
||||
key: "throwIfNotConcretePrimitive",
|
||||
value: function throwIfNotConcretePrimitive() {
|
||||
return this;
|
||||
}
|
||||
}, {
|
||||
key: "toDisplayString",
|
||||
value: function toDisplayString() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}]);
|
||||
|
||||
return PrimitiveValue;
|
||||
}(_index.ConcreteValue);
|
||||
|
||||
exports.default = PrimitiveValue;
|
||||
//# sourceMappingURL=PrimitiveValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/PrimitiveValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/PrimitiveValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/PrimitiveValue.js"],"names":["PrimitiveValue","realm","intrinsicName"],"mappings":";;;;;;;;AAYA;;AACA;;;;;;;;;;+eAbA;;;;;;;;;IAeqBA,c;;;AACnB,0BAAYC,KAAZ,EAA0BC,aAA1B,EAAkD;AAAA;;AAChD,6BAAUD,KAAV,EAAiB,gBAAjB;AADgD,2HAE1CA,KAF0C,EAEnCC,aAFmC;AAGjD;;;;kDAE6C;AAC5C,aAAO,IAAP;AACD;;;sCAEyB;AACxB,+BAAU,KAAV,EAAiB,kCAAjB;AACD;;;;;;kBAZkBF,c","file":"PrimitiveValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { Realm } from \"../realm.js\";\nimport { ConcreteValue } from \"./index.js\";\nimport invariant from \"../invariant.js\";\n\nexport default class PrimitiveValue extends ConcreteValue {\n constructor(realm: Realm, intrinsicName?: string) {\n invariant(realm, \"realm required\");\n super(realm, intrinsicName);\n }\n\n throwIfNotConcretePrimitive(): PrimitiveValue {\n return this;\n }\n\n toDisplayString(): string {\n invariant(false, \"abstract method; please override\");\n }\n}\n"]}
|
||||
948
build/node_modules/prepack/lib/values/ProxyValue.js
generated
vendored
Normal file
948
build/node_modules/prepack/lib/values/ProxyValue.js
generated
vendored
Normal file
@@ -0,0 +1,948 @@
|
||||
"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 _realm = require("../realm.js");
|
||||
|
||||
var _index = require("./index.js");
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _abstract = require("../methods/abstract.js");
|
||||
|
||||
var _get = require("../methods/get.js");
|
||||
|
||||
var _is = require("../methods/is.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
var _call = require("../methods/call.js");
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
function FindPropertyKey(realm, keys, key) {
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
if ((0, _abstract.SamePropertyKey)(realm, key, keys[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
var ProxyValue = function (_ObjectValue) {
|
||||
_inherits(ProxyValue, _ObjectValue);
|
||||
|
||||
function ProxyValue(realm) {
|
||||
_classCallCheck(this, ProxyValue);
|
||||
|
||||
// $FlowFixMe TODO #1022: exotics should not have $Realm
|
||||
var _this = _possibleConstructorReturn(this, (ProxyValue.__proto__ || Object.getPrototypeOf(ProxyValue)).call(this, realm));
|
||||
|
||||
_this.$Realm = undefined;
|
||||
_this.realm = realm;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(ProxyValue, [{
|
||||
key: "getTrackedBindings",
|
||||
value: function getTrackedBindings() {
|
||||
return ProxyValue.trackedPropertyNames;
|
||||
}
|
||||
}, {
|
||||
key: "isSimpleObject",
|
||||
value: function isSimpleObject() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.1
|
||||
|
||||
}, {
|
||||
key: "$GetPrototypeOf",
|
||||
value: function $GetPrototypeOf() {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 2. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 3. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected an object");
|
||||
|
||||
// 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
|
||||
// 5. Let trap be ? GetMethod(handler, "getPrototypeOf").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "getPrototypeOf");
|
||||
|
||||
// 6. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[GetPrototypeOf]]().
|
||||
return target.$GetPrototypeOf();
|
||||
}
|
||||
|
||||
// 7. Let handlerProto be ? Call(trap, handler, « target »).
|
||||
var handlerProto = (0, _call.Call)(realm, trap, handler, [target]);
|
||||
|
||||
// 8. If Type(handlerProto) is neither Object nor Null, throw a TypeError exception.
|
||||
if (!(handlerProto instanceof _index.ObjectValue) && !(handlerProto instanceof _index.NullValue)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 9. Let extensibleTarget be ? IsExtensible(target).
|
||||
var extensibleTarget = (0, _is.IsExtensible)(realm, target);
|
||||
|
||||
// 10. If extensibleTarget is true, return handlerProto.
|
||||
if (extensibleTarget) return handlerProto;
|
||||
|
||||
// 11. Let targetProto be ? target.[[GetPrototypeOf]]().
|
||||
var targetProto = target.$GetPrototypeOf();
|
||||
|
||||
// 12. If SameValue(handlerProto, targetProto) is false, throw a TypeError exception.
|
||||
if (!(0, _abstract.SameValue)(realm, handlerProto, targetProto)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 13. Return handlerProto.
|
||||
return handlerProto;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.2
|
||||
|
||||
}, {
|
||||
key: "$SetPrototypeOf",
|
||||
value: function $SetPrototypeOf(V) {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Assert: Either Type(V) is Object or Type(V) is Null.
|
||||
(0, _invariant2.default)(V instanceof _index.ObjectValue || V instanceof _index.NullValue, "expected object or null");
|
||||
|
||||
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 3. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 4. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
|
||||
// 6. Let trap be ? GetMethod(handler, "setPrototypeOf").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "setPrototypeOf");
|
||||
|
||||
// 7. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[SetPrototypeOf]](V).
|
||||
return target.$SetPrototypeOf(V);
|
||||
}
|
||||
|
||||
// 8. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target, V »)).
|
||||
var booleanTrapResult = _singletons.To.ToBooleanPartial(realm, (0, _call.Call)(realm, trap, handler, [target, V]));
|
||||
|
||||
// 9. If booleanTrapResult is false, return false.
|
||||
if (!booleanTrapResult) return false;
|
||||
|
||||
// 10. Let extensibleTarget be ? IsExtensible(target).
|
||||
var extensibleTarget = (0, _is.IsExtensible)(realm, target);
|
||||
|
||||
// 11. If extensibleTarget is true, return true.
|
||||
if (extensibleTarget) return true;
|
||||
|
||||
// 12. Let targetProto be ? target.[[GetPrototypeOf]]().
|
||||
var targetProto = target.$GetPrototypeOf();
|
||||
|
||||
// 13. If SameValue(V, targetProto) is false, throw a TypeError exception.
|
||||
if (!(0, _abstract.SameValue)(realm, V, targetProto)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 14. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.3
|
||||
|
||||
}, {
|
||||
key: "$IsExtensible",
|
||||
value: function $IsExtensible() {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 2. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 3. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
|
||||
// 5. Let trap be ? GetMethod(handler, "isExtensible").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "isExtensible");
|
||||
|
||||
// 6. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[IsExtensible]]().
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
return target.$IsExtensible();
|
||||
}
|
||||
|
||||
// 7. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target »)).
|
||||
var booleanTrapResult = _singletons.To.ToBooleanPartial(realm, (0, _call.Call)(realm, trap, handler, [target]));
|
||||
|
||||
// 8. Let targetResult be ? target.[[IsExtensible]]().
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
var targetResult = target.$IsExtensible();
|
||||
|
||||
// 9. If SameValue(booleanTrapResult, targetResult) is false, throw a TypeError exception.
|
||||
if (booleanTrapResult !== targetResult) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 10. Return booleanTrapResult.
|
||||
return booleanTrapResult;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.4
|
||||
|
||||
}, {
|
||||
key: "$PreventExtensions",
|
||||
value: function $PreventExtensions() {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 2. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 3. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
|
||||
// 5. Let trap be ? GetMethod(handler, "preventExtensions").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "preventExtensions");
|
||||
|
||||
// 6. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[PreventExtensions]]().
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
return target.$PreventExtensions();
|
||||
}
|
||||
|
||||
// 7. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target »)).
|
||||
var booleanTrapResult = _singletons.To.ToBooleanPartial(realm, (0, _call.Call)(realm, trap, handler, [target]));
|
||||
|
||||
// 8. If booleanTrapResult is true, then
|
||||
if (booleanTrapResult) {
|
||||
// a. Let targetIsExtensible be ? target.[[IsExtensible]]().
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
var targetIsExtensible = target.$IsExtensible();
|
||||
|
||||
// b. If targetIsExtensible is true, throw a TypeError exception.
|
||||
if (targetIsExtensible) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
|
||||
// 9. Return booleanTrapResult.
|
||||
return booleanTrapResult;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.5
|
||||
|
||||
}, {
|
||||
key: "$GetOwnProperty",
|
||||
value: function $GetOwnProperty(P) {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(realm, P), "expected property key");
|
||||
|
||||
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 3. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 4. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
|
||||
// 6. Let trap be ? GetMethod(handler, "getOwnPropertyDescriptor").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "getOwnPropertyDescriptor");
|
||||
|
||||
// 7. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[GetOwnProperty]](P).
|
||||
return target.$GetOwnProperty(P);
|
||||
}
|
||||
|
||||
// 8. Let trapResultObj be ? Call(trap, handler, « target, P »).
|
||||
var trapResultObj = (0, _call.Call)(realm, trap, handler, [target, typeof P === "string" ? new _index.StringValue(realm, P) : P]);
|
||||
|
||||
// 9. If Type(trapResultObj) is neither Object nor Undefined, throw a TypeError exception.
|
||||
if (!(trapResultObj instanceof _index.ObjectValue) && !(trapResultObj instanceof _index.UndefinedValue)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 10. Let targetDesc be ? target.[[GetOwnProperty]](P).
|
||||
var targetDesc = target.$GetOwnProperty(P);
|
||||
|
||||
// 11. If trapResultObj is undefined, then
|
||||
if (trapResultObj instanceof _index.UndefinedValue) {
|
||||
// a. If targetDesc is undefined, return undefined.
|
||||
if (!targetDesc) return undefined;
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(targetDesc.value);
|
||||
|
||||
// b. If targetDesc.[[Configurable]] is false, throw a TypeError exception.
|
||||
if (!targetDesc.configurable) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// c. Let extensibleTarget be ? IsExtensible(target).
|
||||
var _extensibleTarget = (0, _is.IsExtensible)(realm, target);
|
||||
|
||||
// d. Assert: Type(extensibleTarget) is Boolean.
|
||||
(0, _invariant2.default)(typeof _extensibleTarget === "boolean", "expected boolean");
|
||||
|
||||
// e. If extensibleTarget is false, throw a TypeError exception.
|
||||
if (!_extensibleTarget) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// f. Return undefined.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// 12. Let extensibleTarget be ? IsExtensible(target).
|
||||
var extensibleTarget = (0, _is.IsExtensible)(realm, target);
|
||||
|
||||
// 13. Let resultDesc be ? ToPropertyDescriptor(trapResultObj).
|
||||
var resultDesc = _singletons.To.ToPropertyDescriptor(realm, trapResultObj);
|
||||
|
||||
// 14. Call CompletePropertyDescriptor(resultDesc).
|
||||
_singletons.Properties.CompletePropertyDescriptor(realm, resultDesc);
|
||||
|
||||
// 15. Let valid be IsCompatiblePropertyDescriptor(extensibleTarget, resultDesc, targetDesc).
|
||||
var valid = _singletons.Properties.IsCompatiblePropertyDescriptor(realm, extensibleTarget, resultDesc, targetDesc);
|
||||
|
||||
// 16. If valid is false, throw a TypeError exception.
|
||||
if (!valid) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 17. If resultDesc.[[Configurable]] is false, then
|
||||
if (!resultDesc.configurable) {
|
||||
// a. If targetDesc is undefined or targetDesc.[[Configurable]] is true, then
|
||||
if (!targetDesc || targetDesc.configurable) {
|
||||
// i. Throw a TypeError exception.
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
|
||||
// 18. Return resultDesc.
|
||||
return resultDesc;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.6
|
||||
|
||||
}, {
|
||||
key: "$DefineOwnProperty",
|
||||
value: function $DefineOwnProperty(P, Desc) {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(realm, P), "expected property key");
|
||||
|
||||
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 3. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 4. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
|
||||
// 6. Let trap be ? GetMethod(handler, "defineProperty").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "defineProperty");
|
||||
|
||||
// 7. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[DefineOwnProperty]](P, Desc).
|
||||
return target.$DefineOwnProperty(P, Desc);
|
||||
}
|
||||
|
||||
// 8. Let descObj be FromPropertyDescriptor(Desc).
|
||||
var descObj = _singletons.Properties.FromPropertyDescriptor(realm, Desc);
|
||||
|
||||
// 9. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target, P, descObj »)).
|
||||
var booleanTrapResult = _singletons.To.ToBooleanPartial(realm, (0, _call.Call)(realm, trap, handler, [target, typeof P === "string" ? new _index.StringValue(realm, P) : P, descObj]));
|
||||
|
||||
// 10. If booleanTrapResult is false, return false.
|
||||
if (!booleanTrapResult) return false;
|
||||
|
||||
// 11. Let targetDesc be ? target.[[GetOwnProperty]](P).
|
||||
var targetDesc = target.$GetOwnProperty(P);
|
||||
|
||||
// 12. Let extensibleTarget be ? IsExtensible(target).
|
||||
var extensibleTarget = (0, _is.IsExtensible)(realm, target);
|
||||
|
||||
// 13. If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is false, then
|
||||
var settingConfigFalse = void 0;
|
||||
if ("configurable" in Desc && !Desc.configurable) {
|
||||
// a. Let settingConfigFalse be true.
|
||||
settingConfigFalse = true;
|
||||
} else {
|
||||
// 14. Else let settingConfigFalse be false.
|
||||
settingConfigFalse = false;
|
||||
}
|
||||
|
||||
// 15. If targetDesc is undefined, then
|
||||
if (!targetDesc) {
|
||||
// a. If extensibleTarget is false, throw a TypeError exception.
|
||||
if (!extensibleTarget) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// b. If settingConfigFalse is true, throw a TypeError exception.
|
||||
if (settingConfigFalse) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
} else {
|
||||
// 16. Else targetDesc is not undefined,
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(targetDesc.value);
|
||||
|
||||
// a. If IsCompatiblePropertyDescriptor(extensibleTarget, Desc, targetDesc) is false, throw a TypeError exception.
|
||||
if (!_singletons.Properties.IsCompatiblePropertyDescriptor(realm, extensibleTarget, Desc, targetDesc)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// b. If settingConfigFalse is true and targetDesc.[[Configurable]] is true, throw a TypeError exception.
|
||||
if (settingConfigFalse && targetDesc.configurable) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
|
||||
// 17. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.7
|
||||
|
||||
}, {
|
||||
key: "$HasProperty",
|
||||
value: function $HasProperty(P) {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(realm, P), "expected property key");
|
||||
|
||||
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 3. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 4. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
|
||||
// 6. Let trap be ? GetMethod(handler, "has").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "has");
|
||||
|
||||
// 7. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[HasProperty]](P).
|
||||
return target.$HasProperty(P);
|
||||
}
|
||||
|
||||
// 8. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target, P »)).
|
||||
var booleanTrapResult = _singletons.To.ToBooleanPartial(realm, (0, _call.Call)(realm, trap, handler, [target, typeof P === "string" ? new _index.StringValue(realm, P) : P]));
|
||||
|
||||
// 9. If booleanTrapResult is false, then
|
||||
if (!booleanTrapResult) {
|
||||
// a. Let targetDesc be ? target.[[GetOwnProperty]](P).
|
||||
var targetDesc = target.$GetOwnProperty(P);
|
||||
|
||||
// b. If targetDesc is not undefined, then
|
||||
if (targetDesc) {
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(targetDesc.value);
|
||||
|
||||
// i. If targetDesc.[[Configurable]] is false, throw a TypeError exception.
|
||||
if (!targetDesc.configurable) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// ii. Let extensibleTarget be ? IsExtensible(target).
|
||||
var extensibleTarget = (0, _is.IsExtensible)(realm, target);
|
||||
|
||||
// iii. If extensibleTarget is false, throw a TypeError exception.
|
||||
if (!extensibleTarget) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 10. Return booleanTrapResult.
|
||||
return booleanTrapResult;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.8
|
||||
|
||||
}, {
|
||||
key: "$Get",
|
||||
value: function $Get(P, Receiver) {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(realm, P), "expected property key");
|
||||
|
||||
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 3. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 4. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
|
||||
// 6. Let trap be ? GetMethod(handler, "get").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "get");
|
||||
|
||||
// 7. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[Get]](P, Receiver).
|
||||
return target.$Get(P, Receiver);
|
||||
}
|
||||
|
||||
// 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »).
|
||||
var trapResult = (0, _call.Call)(realm, trap, handler, [target, typeof P === "string" ? new _index.StringValue(realm, P) : P, Receiver]);
|
||||
|
||||
// 9. Let targetDesc be ? target.[[GetOwnProperty]](P).
|
||||
var targetDesc = target.$GetOwnProperty(P);
|
||||
|
||||
// 10. If targetDesc is not undefined, then
|
||||
if (targetDesc) {
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(targetDesc.value);
|
||||
|
||||
// a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Configurable]] is false and targetDesc.[[Writable]] is false, then
|
||||
if ((0, _is.IsDataDescriptor)(realm, targetDesc) && targetDesc.configurable === false && targetDesc.writable === false) {
|
||||
// i. If SameValue(trapResult, targetDesc.[[Value]]) is false, throw a TypeError exception.
|
||||
var targetValue = targetDesc.value || realm.intrinsics.undefined;
|
||||
(0, _invariant2.default)(targetValue instanceof _index.Value);
|
||||
if (!(0, _abstract.SameValuePartial)(realm, trapResult, targetValue)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
|
||||
// b. If IsAccessorDescriptor(targetDesc) is true and targetDesc.[[Configurable]] is false and targetDesc.[[Get]] is undefined, then
|
||||
if ((0, _is.IsAccessorDescriptor)(realm, targetDesc) && targetDesc.configurable === false && (!targetDesc.get || targetDesc.get instanceof _index.UndefinedValue)) {
|
||||
// i. If trapResult is not undefined, throw a TypeError exception.
|
||||
if (!(trapResult instanceof _index.UndefinedValue)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 11. Return trapResult.
|
||||
return trapResult;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.9
|
||||
|
||||
}, {
|
||||
key: "$Set",
|
||||
value: function $Set(P, V, Receiver) {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(realm, P), "expected property key");
|
||||
|
||||
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 3. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 4. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
|
||||
// 6. Let trap be ? GetMethod(handler, "set").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "set");
|
||||
|
||||
// 7. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[Set]](P, V, Receiver).
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
return target.$Set(P, V, Receiver);
|
||||
}
|
||||
|
||||
// 8. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target, P, V, Receiver »)).
|
||||
var booleanTrapResult = _singletons.To.ToBooleanPartial(realm, (0, _call.Call)(realm, trap, handler, [target, typeof P === "string" ? new _index.StringValue(realm, P) : P, V, Receiver]));
|
||||
|
||||
// 9. If booleanTrapResult is false, return false.
|
||||
if (!booleanTrapResult) return false;
|
||||
|
||||
// 10. Let targetDesc be ? target.[[GetOwnProperty]](P).
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
var targetDesc = target.$GetOwnProperty(P);
|
||||
|
||||
// 11. If targetDesc is not undefined, then
|
||||
if (targetDesc) {
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(targetDesc.value);
|
||||
|
||||
// a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Configurable]] is false and targetDesc.[[Writable]] is false, then
|
||||
if ((0, _is.IsDataDescriptor)(realm, targetDesc) && !targetDesc.configurable && !targetDesc.writable) {
|
||||
// i. If SameValue(V, targetDesc.[[Value]]) is false, throw a TypeError exception.
|
||||
var targetValue = targetDesc.value || realm.intrinsics.undefined;
|
||||
(0, _invariant2.default)(targetValue instanceof _index.Value);
|
||||
if (!(0, _abstract.SameValuePartial)(realm, V, targetValue)) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
|
||||
// b. If IsAccessorDescriptor(targetDesc) is true and targetDesc.[[Configurable]] is false, then
|
||||
if ((0, _is.IsAccessorDescriptor)(realm, targetDesc) && !targetDesc.configurable) {
|
||||
// i. If targetDesc.[[Set]] is undefined, throw a TypeError exception.
|
||||
if (!targetDesc.set || targetDesc.set instanceof _index.UndefinedValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 12. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.10
|
||||
|
||||
}, {
|
||||
key: "$Delete",
|
||||
value: function $Delete(P) {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
(0, _invariant2.default)((0, _is.IsPropertyKey)(realm, P), "expected property key");
|
||||
|
||||
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 3. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 4. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
|
||||
// 6. Let trap be ? GetMethod(handler, "deleteProperty").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "deleteProperty");
|
||||
|
||||
// 7. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[Delete]](P).
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
return target.$Delete(P);
|
||||
}
|
||||
|
||||
// 8. Let booleanTrapResult be ToBoolean(? Call(trap, handler, « target, P »)).
|
||||
var booleanTrapResult = _singletons.To.ToBooleanPartial(realm, (0, _call.Call)(realm, trap, handler, [target, typeof P === "string" ? new _index.StringValue(realm, P) : P]));
|
||||
|
||||
// 9. If booleanTrapResult is false, return false.
|
||||
if (!booleanTrapResult) return false;
|
||||
|
||||
// 10. Let targetDesc be ? target.[[GetOwnProperty]](P).
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
var targetDesc = target.$GetOwnProperty(P);
|
||||
|
||||
// 11. If targetDesc is undefined, return true.
|
||||
if (!targetDesc) return true;
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(targetDesc.value);
|
||||
|
||||
// 12. If targetDesc.[[Configurable]] is false, throw a TypeError exception.
|
||||
if (!targetDesc.configurable) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 13. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// ECMA262 9.5.11
|
||||
|
||||
}, {
|
||||
key: "$OwnPropertyKeys",
|
||||
value: function $OwnPropertyKeys() {
|
||||
var realm = this.realm;
|
||||
|
||||
// 1. Let handler be the value of the [[ProxyHandler]] internal slot of O.
|
||||
var handler = this.$ProxyHandler;
|
||||
|
||||
// 2. If handler is null, throw a TypeError exception.
|
||||
if (handler instanceof _index.NullValue) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 3. Assert: Type(handler) is Object.
|
||||
(0, _invariant2.default)(handler instanceof _index.ObjectValue, "expected object");
|
||||
|
||||
// 4. Let target be the value of the [[ProxyTarget]] internal slot of O.
|
||||
var target = this.$ProxyTarget;
|
||||
(0, _invariant2.default)(target instanceof _index.ObjectValue);
|
||||
|
||||
// 5. Let trap be ? GetMethod(handler, "ownKeys").
|
||||
var trap = (0, _get.GetMethod)(realm, handler, "ownKeys");
|
||||
|
||||
// 6. If trap is undefined, then
|
||||
if (trap instanceof _index.UndefinedValue) {
|
||||
// a. Return ? target.[[OwnPropertyKeys]]().
|
||||
return target.$OwnPropertyKeys();
|
||||
}
|
||||
|
||||
// 7. Let trapResultArray be ? Call(trap, handler, « target »).
|
||||
var trapResultArray = (0, _call.Call)(realm, trap, handler, [target]);
|
||||
|
||||
// 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »).
|
||||
var trapResult = _singletons.Create.CreateListFromArrayLike(realm, trapResultArray, ["String", "Symbol"]);
|
||||
|
||||
// 9. Let extensibleTarget be ? IsExtensible(target).
|
||||
var extensibleTarget = (0, _is.IsExtensible)(realm, target);
|
||||
|
||||
// 10. Let targetKeys be ? target.[[OwnPropertyKeys]]().
|
||||
var targetKeys = target.$OwnPropertyKeys();
|
||||
|
||||
// 11. Assert: targetKeys is a List containing only String and Symbol values.
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = targetKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var key = _step.value;
|
||||
|
||||
(0, _invariant2.default)(key instanceof _index.SymbolValue || key instanceof _index.StringValue, "expected string or symbol");
|
||||
}
|
||||
|
||||
// 12. Let targetConfigurableKeys be a new empty List.
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var targetConfigurableKeys = [];
|
||||
|
||||
// 13. Let targetNonconfigurableKeys be a new empty List.
|
||||
var targetNonconfigurableKeys = [];
|
||||
|
||||
// 14. Repeat, for each element key of targetKeys,
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = targetKeys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var _key = _step2.value;
|
||||
|
||||
// a. Let desc be ? target.[[GetOwnProperty]](key).
|
||||
var desc = target.$GetOwnProperty(_key);
|
||||
if (desc) _singletons.Properties.ThrowIfMightHaveBeenDeleted(desc.value);
|
||||
|
||||
// b. If desc is not undefined and desc.[[Configurable]] is false, then
|
||||
if (desc && desc.configurable === false) {
|
||||
// i. Append key as an element of targetNonconfigurableKeys.
|
||||
targetNonconfigurableKeys.push(_key);
|
||||
} else {
|
||||
// c. Else,
|
||||
// i. Append key as an element of targetConfigurableKeys.
|
||||
targetConfigurableKeys.push(_key);
|
||||
}
|
||||
}
|
||||
|
||||
// 15. If extensibleTarget is true and targetNonconfigurableKeys is empty, then
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (extensibleTarget && !targetNonconfigurableKeys.length) {
|
||||
// a. Return trapResult.
|
||||
return trapResult;
|
||||
}
|
||||
|
||||
// 16. Let uncheckedResultKeys be a new List which is a copy of trapResult.
|
||||
var uncheckedResultKeys = trapResult.slice();
|
||||
|
||||
// 17. Repeat, for each key that is an element of targetNonconfigurableKeys,
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = targetNonconfigurableKeys[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var _key2 = _step3.value;
|
||||
|
||||
// a. If key is not an element of uncheckedResultKeys, throw a TypeError exception.
|
||||
var index = FindPropertyKey(realm, uncheckedResultKeys, _key2);
|
||||
if (index < 0) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError, "key is not an element of uncheckedResultKeys");
|
||||
}
|
||||
|
||||
// b. Remove key from uncheckedResultKeys.
|
||||
uncheckedResultKeys.splice(index, 1);
|
||||
}
|
||||
|
||||
// 18. If extensibleTarget is true, return trapResult.
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (extensibleTarget) return trapResult;
|
||||
|
||||
// 19. Repeat, for each key that is an element of targetConfigurableKeys,
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator4 = targetConfigurableKeys[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
||||
var _key3 = _step4.value;
|
||||
|
||||
// a. If key is not an element of uncheckedResultKeys, throw a TypeError exception.
|
||||
var index = FindPropertyKey(realm, uncheckedResultKeys, _key3);
|
||||
if (index < 0) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError, "key is not an element of uncheckedResultKeys");
|
||||
}
|
||||
|
||||
// b. Remove key from uncheckedResultKeys.
|
||||
uncheckedResultKeys.splice(index, 1);
|
||||
}
|
||||
|
||||
// 20. If uncheckedResultKeys is not empty, throw a TypeError exception.
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (uncheckedResultKeys.length) {
|
||||
throw realm.createErrorThrowCompletion(realm.intrinsics.TypeError);
|
||||
}
|
||||
|
||||
// 21. Return trapResult.
|
||||
return trapResult;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ProxyValue;
|
||||
}(_index.ObjectValue);
|
||||
|
||||
ProxyValue.trackedPropertyNames = _index.ObjectValue.trackedPropertyNames.concat(["$ProxyTarget", "$ProxyHandler"]);
|
||||
exports.default = ProxyValue;
|
||||
//# sourceMappingURL=ProxyValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/ProxyValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/ProxyValue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
226
build/node_modules/prepack/lib/values/StringExotic.js
generated
vendored
Normal file
226
build/node_modules/prepack/lib/values/StringExotic.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
"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("../values/index.js");
|
||||
|
||||
var _is = require("../methods/is.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
var _invariant = require("../invariant");
|
||||
|
||||
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 StringExotic = function (_ObjectValue) {
|
||||
_inherits(StringExotic, _ObjectValue);
|
||||
|
||||
function StringExotic(realm, intrinsicName) {
|
||||
_classCallCheck(this, StringExotic);
|
||||
|
||||
return _possibleConstructorReturn(this, (StringExotic.__proto__ || Object.getPrototypeOf(StringExotic)).call(this, realm, realm.intrinsics.StringPrototype, intrinsicName));
|
||||
}
|
||||
|
||||
// ECMA262 9.4.3.1
|
||||
|
||||
|
||||
_createClass(StringExotic, [{
|
||||
key: "$GetOwnProperty",
|
||||
value: function $GetOwnProperty(P) {
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
|
||||
// 2. Let desc be OrdinaryGetOwnProperty(S, P).
|
||||
var desc = _singletons.Properties.OrdinaryGetOwnProperty(this.$Realm, this, P);
|
||||
|
||||
// 3. If desc is not undefined, return desc.
|
||||
if (desc !== undefined) {
|
||||
_singletons.Properties.ThrowIfMightHaveBeenDeleted(desc.value);
|
||||
return desc;
|
||||
}
|
||||
|
||||
// 4. If Type(P) is not String, return undefined.
|
||||
if (typeof P !== "string" && !(P instanceof _index.StringValue)) return undefined;
|
||||
|
||||
// 5. Let index be ! CanonicalNumericIndexString(P).
|
||||
var index = _singletons.To.CanonicalNumericIndexString(this.$Realm, typeof P === "string" ? new _index.StringValue(this.$Realm, P) : P);
|
||||
|
||||
// 6. If index is undefined, return undefined.
|
||||
if (index === undefined || index === null) return undefined;
|
||||
|
||||
// 7. If IsInteger(index) is false, return undefined.
|
||||
if ((0, _is.IsInteger)(this.$Realm, index) === false) return undefined;
|
||||
|
||||
// 8. If index = -0, return undefined.
|
||||
if (1.0 / index === -Infinity) return undefined;
|
||||
|
||||
// 9. Let str be the String value of S.[[StringData]].
|
||||
var str = this.$StringData;
|
||||
(0, _invariant2.default)(str);
|
||||
str = str.throwIfNotConcreteString();
|
||||
|
||||
// 10. Let len be the number of elements in str.
|
||||
var len = str.value.length;
|
||||
|
||||
// 11. If index < 0 or len ≤ index, return undefined.
|
||||
if (index < 0 || len <= index) return undefined;
|
||||
|
||||
// 12. Let resultStr be a String value of length 1, containing one code unit from str, specifically the code unit at index index.
|
||||
var resultStr = new _index.StringValue(this.$Realm, str.value.charAt(index));
|
||||
|
||||
// 13. Return a PropertyDescriptor{[[Value]]: resultStr, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: false}.
|
||||
return {
|
||||
value: resultStr,
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: false
|
||||
};
|
||||
}
|
||||
|
||||
// ECMA262 9.4.3.2
|
||||
|
||||
}, {
|
||||
key: "$OwnPropertyKeys",
|
||||
value: function $OwnPropertyKeys() {
|
||||
var _this2 = this;
|
||||
|
||||
// 1. Let keys be a new empty List.
|
||||
var keys = [];
|
||||
|
||||
// 2. Let str be the String value of O.[[StringData]].
|
||||
var str = this.$StringData;
|
||||
(0, _invariant2.default)(str);
|
||||
str = str.throwIfNotConcreteString();
|
||||
|
||||
// 3. Let len be the number of elements in str.
|
||||
var len = str.value.length;
|
||||
|
||||
// 4. For each integer i starting with 0 such that i < len, in ascending order,
|
||||
for (var i = 0; i < len; ++i) {
|
||||
// a. Add ! ToString(i) as the last element of keys.
|
||||
keys.push(new _index.StringValue(this.$Realm, _singletons.To.ToString(this.$Realm, new _index.NumberValue(this.$Realm, i))));
|
||||
}
|
||||
|
||||
// 5. For each own property key P of O such that P is an integer index and ToInteger(P) ≥ len, in ascending numeric index order,
|
||||
var properties = this.getOwnPropertyKeysArray();
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = properties.filter(function (x) {
|
||||
return (0, _is.IsArrayIndex)(_this2.$Realm, x);
|
||||
}).map(function (x) {
|
||||
return parseInt(x, 10);
|
||||
}).filter(function (x) {
|
||||
return _singletons.To.ToInteger(_this2.$Realm, x) >= len;
|
||||
}).sort(function (x, y) {
|
||||
return x - y;
|
||||
})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var key = _step.value;
|
||||
|
||||
// i. Add P as the last element of keys.
|
||||
keys.push(new _index.StringValue(this.$Realm, key + ""));
|
||||
}
|
||||
|
||||
// 6. For each own property key P of O such that Type(P) is String and P is not an integer index, in ascending chronological order of property creation,
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = properties.filter(function (x) {
|
||||
return !(0, _is.IsArrayIndex)(_this2.$Realm, x);
|
||||
})[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var _key = _step2.value;
|
||||
|
||||
// i. Add P as the last element of keys.
|
||||
keys.push(new _index.StringValue(this.$Realm, _key));
|
||||
}
|
||||
|
||||
// 7. For each own property key P of O such that Type(P) is Symbol, in ascending chronological order of property creation,
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = this.symbols.keys()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var _key2 = _step3.value;
|
||||
|
||||
// i. Add P as the last element of keys.
|
||||
keys.push(_key2);
|
||||
}
|
||||
|
||||
// 12. Return keys.
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
}]);
|
||||
|
||||
return StringExotic;
|
||||
}(_index.ObjectValue);
|
||||
|
||||
exports.default = StringExotic;
|
||||
//# sourceMappingURL=StringExotic.js.map
|
||||
1
build/node_modules/prepack/lib/values/StringExotic.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/StringExotic.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
74
build/node_modules/prepack/lib/values/StringValue.js
generated
vendored
Normal file
74
build/node_modules/prepack/lib/values/StringValue.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"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("../methods/index.js");
|
||||
|
||||
var _index2 = require("../values/index.js");
|
||||
|
||||
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 StringValue = function (_PrimitiveValue) {
|
||||
_inherits(StringValue, _PrimitiveValue);
|
||||
|
||||
function StringValue(realm, value, intrinsicName) {
|
||||
_classCallCheck(this, StringValue);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (StringValue.__proto__ || Object.getPrototypeOf(StringValue)).call(this, realm, intrinsicName));
|
||||
|
||||
_this.value = value;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(StringValue, [{
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof StringValue && this.value === x.value;
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
return (0, _index.hashString)(this.value);
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
return this.value.length === 0;
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteString",
|
||||
value: function throwIfNotConcreteString() {
|
||||
return this;
|
||||
}
|
||||
}, {
|
||||
key: "_serialize",
|
||||
value: function _serialize() {
|
||||
return this.value;
|
||||
}
|
||||
}, {
|
||||
key: "toDisplayString",
|
||||
value: function toDisplayString() {
|
||||
return "\"" + this.value + "\"";
|
||||
}
|
||||
}]);
|
||||
|
||||
return StringValue;
|
||||
}(_index2.PrimitiveValue);
|
||||
|
||||
exports.default = StringValue;
|
||||
//# sourceMappingURL=StringValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/StringValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/StringValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/StringValue.js"],"names":["StringValue","realm","value","intrinsicName","x","length"],"mappings":";;;;;;;;AAWA;;AACA;;;;;;+eAZA;;;;;;;;;IAeqBA,W;;;AACnB,uBAAYC,KAAZ,EAA0BC,KAA1B,EAAyCC,aAAzC,EAAiE;AAAA;;AAAA,0HACzDF,KADyD,EAClDE,aADkD;;AAE/D,UAAKD,KAAL,GAAaA,KAAb;AAF+D;AAGhE;;;;2BAIME,C,EAAmB;AACxB,aAAOA,aAAaJ,WAAb,IAA4B,KAAKE,KAAL,KAAeE,EAAEF,KAApD;AACD;;;8BAEiB;AAChB,aAAO,uBAAW,KAAKA,KAAhB,CAAP;AACD;;;mCAEuB;AACtB,aAAO,KAAKA,KAAL,CAAWG,MAAX,KAAsB,CAA7B;AACD;;;+CAEuC;AACtC,aAAO,IAAP;AACD;;;iCAEoB;AACnB,aAAO,KAAKH,KAAZ;AACD;;;sCAEyB;AACxB,oBAAW,KAAKA,KAAhB;AACD;;;;;;kBA9BkBF,W","file":"StringValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { hashString } from \"../methods/index.js\";\nimport { PrimitiveValue, Value } from \"../values/index.js\";\nimport type { Realm } from \"../realm.js\";\n\nexport default class StringValue extends PrimitiveValue {\n constructor(realm: Realm, value: string, intrinsicName?: string) {\n super(realm, intrinsicName);\n this.value = value;\n }\n\n value: string;\n\n equals(x: Value): boolean {\n return x instanceof StringValue && this.value === x.value;\n }\n\n getHash(): number {\n return hashString(this.value);\n }\n\n mightBeFalse(): boolean {\n return this.value.length === 0;\n }\n\n throwIfNotConcreteString(): StringValue {\n return this;\n }\n\n _serialize(): string {\n return this.value;\n }\n\n toDisplayString(): string {\n return `\"${this.value}\"`;\n }\n}\n"]}
|
||||
80
build/node_modules/prepack/lib/values/SymbolValue.js
generated
vendored
Normal file
80
build/node_modules/prepack/lib/values/SymbolValue.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"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");
|
||||
|
||||
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 SymbolValue = function (_PrimitiveValue) {
|
||||
_inherits(SymbolValue, _PrimitiveValue);
|
||||
|
||||
function SymbolValue(realm, desc, intrinsicName) {
|
||||
_classCallCheck(this, SymbolValue);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (SymbolValue.__proto__ || Object.getPrototypeOf(SymbolValue)).call(this, realm, intrinsicName));
|
||||
|
||||
_this.$Description = desc;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(SymbolValue, [{
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof SymbolValue && this.hashValue === x.hashValue && this.$Description === x.$Description;
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
if (!this.hashValue) {
|
||||
this.hashValue = this.$Description ? this.$Description.getHash() : ++this.$Realm.symbolCount;
|
||||
}
|
||||
return this.hashValue;
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteSymbol",
|
||||
value: function throwIfNotConcreteSymbol() {
|
||||
return this;
|
||||
}
|
||||
}, {
|
||||
key: "_serialize",
|
||||
value: function _serialize() {
|
||||
return Symbol(this.$Description);
|
||||
}
|
||||
}, {
|
||||
key: "toDisplayString",
|
||||
value: function toDisplayString() {
|
||||
if (this.$Description) {
|
||||
if (this.$Description instanceof _index.PrimitiveValue) {
|
||||
return "Symbol(" + this.$Description.toDisplayString() + ")";
|
||||
}
|
||||
}
|
||||
return "Symbol(to be supported)";
|
||||
}
|
||||
}]);
|
||||
|
||||
return SymbolValue;
|
||||
}(_index.PrimitiveValue);
|
||||
|
||||
exports.default = SymbolValue;
|
||||
//# sourceMappingURL=SymbolValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/SymbolValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/SymbolValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/SymbolValue.js"],"names":["SymbolValue","realm","desc","intrinsicName","$Description","x","hashValue","getHash","$Realm","symbolCount","Symbol","toDisplayString"],"mappings":";;;;;;;;AAWA;;;;;;+eAXA;;;;;;;;;IAcqBA,W;;;AACnB,uBAAYC,KAAZ,EAA0BC,IAA1B,EAA8CC,aAA9C,EAAsE;AAAA;;AAAA,0HAC9DF,KAD8D,EACvDE,aADuD;;AAEpE,UAAKC,YAAL,GAAoBF,IAApB;AAFoE;AAGrE;;;;2BAMMG,C,EAAmB;AACxB,aAAOA,aAAaL,WAAb,IAA4B,KAAKM,SAAL,KAAmBD,EAAEC,SAAjD,IAA8D,KAAKF,YAAL,KAAsBC,EAAED,YAA7F;AACD;;;8BAEiB;AAChB,UAAI,CAAC,KAAKE,SAAV,EAAqB;AACnB,aAAKA,SAAL,GAAiB,KAAKF,YAAL,GAAoB,KAAKA,YAAL,CAAkBG,OAAlB,EAApB,GAAkD,EAAE,KAAKC,MAAL,CAAYC,WAAjF;AACD;AACD,aAAO,KAAKH,SAAZ;AACD;;;mCAEuB;AACtB,aAAO,KAAP;AACD;;;+CAEuC;AACtC,aAAO,IAAP;AACD;;;iCAEoB;AACnB,aAAOI,OAAO,KAAKN,YAAZ,CAAP;AACD;;;sCAEyB;AACxB,UAAI,KAAKA,YAAT,EAAuB;AACrB,YAAI,KAAKA,YAAL,iCAAJ,EAAiD;AAC/C,6BAAiB,KAAKA,YAAL,CAAkBO,eAAlB,EAAjB;AACD;AACF;AACD,aAAO,yBAAP;AACD;;;;;;kBAxCkBX,W","file":"SymbolValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { PrimitiveValue, Value } from \"./index.js\";\nimport type { Realm } from \"../realm.js\";\n\nexport default class SymbolValue extends PrimitiveValue {\n constructor(realm: Realm, desc: void | Value, intrinsicName?: string) {\n super(realm, intrinsicName);\n this.$Description = desc;\n }\n\n $Description: void | Value;\n\n hashValue: void | number;\n\n equals(x: Value): boolean {\n return x instanceof SymbolValue && this.hashValue === x.hashValue && this.$Description === x.$Description;\n }\n\n getHash(): number {\n if (!this.hashValue) {\n this.hashValue = this.$Description ? this.$Description.getHash() : ++this.$Realm.symbolCount;\n }\n return this.hashValue;\n }\n\n mightBeFalse(): boolean {\n return false;\n }\n\n throwIfNotConcreteSymbol(): SymbolValue {\n return this;\n }\n\n _serialize(): Symbol {\n return Symbol(this.$Description);\n }\n\n toDisplayString(): string {\n if (this.$Description) {\n if (this.$Description instanceof PrimitiveValue) {\n return `Symbol(${this.$Description.toDisplayString()})`;\n }\n }\n return \"Symbol(to be supported)\";\n }\n}\n"]}
|
||||
64
build/node_modules/prepack/lib/values/UndefinedValue.js
generated
vendored
Normal file
64
build/node_modules/prepack/lib/values/UndefinedValue.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"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");
|
||||
|
||||
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 UndefinedValue = function (_PrimitiveValue) {
|
||||
_inherits(UndefinedValue, _PrimitiveValue);
|
||||
|
||||
function UndefinedValue() {
|
||||
_classCallCheck(this, UndefinedValue);
|
||||
|
||||
return _possibleConstructorReturn(this, (UndefinedValue.__proto__ || Object.getPrototypeOf(UndefinedValue)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(UndefinedValue, [{
|
||||
key: "_serialize",
|
||||
value: function _serialize() {
|
||||
return undefined;
|
||||
}
|
||||
}, {
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
return x instanceof UndefinedValue && !(x instanceof _index.EmptyValue);
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
return 792057514635681;
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "toDisplayString",
|
||||
value: function toDisplayString() {
|
||||
return "undefined";
|
||||
}
|
||||
}]);
|
||||
|
||||
return UndefinedValue;
|
||||
}(_index.PrimitiveValue);
|
||||
|
||||
exports.default = UndefinedValue;
|
||||
//# sourceMappingURL=UndefinedValue.js.map
|
||||
1
build/node_modules/prepack/lib/values/UndefinedValue.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/UndefinedValue.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/UndefinedValue.js"],"names":["UndefinedValue","undefined","x"],"mappings":";;;;;;;;AAWA;;;;;;+eAXA;;;;;;;;;IAaqBA,c;;;;;;;;;;;iCACN;AACX,aAAOC,SAAP;AACD;;;2BAEMC,C,EAAmB;AACxB,aAAOA,aAAaF,cAAb,IAA+B,EAAEE,8BAAF,CAAtC;AACD;;;8BAEiB;AAChB,aAAO,eAAP;AACD;;;mCAEuB;AACtB,aAAO,IAAP;AACD;;;sCAEyB;AACxB,aAAO,WAAP;AACD;;;;;;kBAnBkBF,c","file":"UndefinedValue.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { EmptyValue, PrimitiveValue, Value } from \"./index.js\";\n\nexport default class UndefinedValue extends PrimitiveValue {\n _serialize() {\n return undefined;\n }\n\n equals(x: Value): boolean {\n return x instanceof UndefinedValue && !(x instanceof EmptyValue);\n }\n\n getHash(): number {\n return 792057514635681;\n }\n\n mightBeFalse(): boolean {\n return true;\n }\n\n toDisplayString(): string {\n return \"undefined\";\n }\n}\n"]}
|
||||
262
build/node_modules/prepack/lib/values/Value.js
generated
vendored
Normal file
262
build/node_modules/prepack/lib/values/Value.js
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
"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; }; }(); /**
|
||||
* 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 _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"); } }
|
||||
|
||||
var Value = function () {
|
||||
function Value(realm, intrinsicName) {
|
||||
_classCallCheck(this, Value);
|
||||
|
||||
(0, _invariant2.default)(realm, "realm required");
|
||||
|
||||
this.$Realm = realm;
|
||||
this.intrinsicName = intrinsicName;
|
||||
this.expressionLocation = realm.currentLocation;
|
||||
}
|
||||
// Name from original source if existant
|
||||
|
||||
|
||||
_createClass(Value, [{
|
||||
key: "equals",
|
||||
value: function equals(x) {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "getHash",
|
||||
value: function getHash() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "getType",
|
||||
value: function getType() {
|
||||
return this.constructor;
|
||||
}
|
||||
}, {
|
||||
key: "implies",
|
||||
value: function implies(val) {
|
||||
if (this.equals(val)) return true;
|
||||
if (!this.mightNotBeFalse()) return true;
|
||||
if (!val.mightNotBeTrue()) return true;
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "isIntrinsic",
|
||||
value: function isIntrinsic() {
|
||||
return !!this.intrinsicName;
|
||||
}
|
||||
}, {
|
||||
key: "isPartialObject",
|
||||
value: function isPartialObject() {
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "isSimpleObject",
|
||||
value: function isSimpleObject() {
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeFalse",
|
||||
value: function mightNotBeFalse() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightBeNull",
|
||||
value: function mightBeNull() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeNull",
|
||||
value: function mightNotBeNull() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightBeNumber",
|
||||
value: function mightBeNumber() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeNumber",
|
||||
value: function mightNotBeNumber() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeObject",
|
||||
value: function mightNotBeObject() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightBeObject",
|
||||
value: function mightBeObject() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightBeString",
|
||||
value: function mightBeString() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeString",
|
||||
value: function mightNotBeString() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightBeTrue",
|
||||
value: function mightBeTrue() {
|
||||
return this.mightNotBeFalse();
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeTrue",
|
||||
value: function mightNotBeTrue() {
|
||||
return this.mightBeFalse();
|
||||
}
|
||||
}, {
|
||||
key: "mightBeUndefined",
|
||||
value: function mightBeUndefined() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeUndefined",
|
||||
value: function mightNotBeUndefined() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "mightHaveBeenDeleted",
|
||||
value: function mightHaveBeenDeleted() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "promoteEmptyToUndefined",
|
||||
value: function promoteEmptyToUndefined() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcrete",
|
||||
value: function throwIfNotConcrete() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteNumber",
|
||||
value: function throwIfNotConcreteNumber() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteString",
|
||||
value: function throwIfNotConcreteString() {
|
||||
throw new Error("abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteBoolean",
|
||||
value: function throwIfNotConcreteBoolean() {
|
||||
throw new Error("abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteSymbol",
|
||||
value: function throwIfNotConcreteSymbol() {
|
||||
throw new Error("abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcreteObject",
|
||||
value: function throwIfNotConcreteObject() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotConcretePrimitive",
|
||||
value: function throwIfNotConcretePrimitive() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "throwIfNotObject",
|
||||
value: function throwIfNotObject() {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}, {
|
||||
key: "serialize",
|
||||
value: function serialize() {
|
||||
var _this = this;
|
||||
|
||||
var stack = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map();
|
||||
|
||||
if (stack.has(this)) {
|
||||
return stack.get(this);
|
||||
} else {
|
||||
var set = function set(val) {
|
||||
stack.set(_this, val);
|
||||
return val;
|
||||
};
|
||||
|
||||
return set(this._serialize(set, stack));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_serialize",
|
||||
value: function _serialize(set, stack) {
|
||||
(0, _invariant2.default)(false, "abstract method; please override");
|
||||
}
|
||||
}], [{
|
||||
key: "getTypeFromName",
|
||||
value: function getTypeFromName(typeName) {
|
||||
switch (typeName) {
|
||||
case "empty":
|
||||
return _index.EmptyValue;
|
||||
case "void":
|
||||
return _index.UndefinedValue;
|
||||
case "null":
|
||||
return _index.NullValue;
|
||||
case "boolean":
|
||||
return _index.BooleanValue;
|
||||
case "string":
|
||||
return _index.StringValue;
|
||||
case "symbol":
|
||||
return _index.SymbolValue;
|
||||
case "number":
|
||||
return _index.NumberValue;
|
||||
case "object":
|
||||
return _index.ObjectValue;
|
||||
case "array":
|
||||
return _index.ArrayValue;
|
||||
case "function":
|
||||
return _index.FunctionValue;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "isTypeCompatibleWith",
|
||||
value: function isTypeCompatibleWith(type, Constructor) {
|
||||
return type.prototype instanceof Constructor || type.prototype === Constructor.prototype;
|
||||
}
|
||||
|
||||
// The source location of the expression that first produced this value.
|
||||
|
||||
}]);
|
||||
|
||||
return Value;
|
||||
}();
|
||||
|
||||
exports.default = Value;
|
||||
//# sourceMappingURL=Value.js.map
|
||||
1
build/node_modules/prepack/lib/values/Value.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/Value.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
227
build/node_modules/prepack/lib/values/index.js
generated
vendored
Normal file
227
build/node_modules/prepack/lib/values/index.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _Value = require("./Value.js");
|
||||
|
||||
Object.defineProperty(exports, "Value", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_Value).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ConcreteValue = require("./ConcreteValue.js");
|
||||
|
||||
Object.defineProperty(exports, "ConcreteValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ConcreteValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _PrimitiveValue = require("./PrimitiveValue.js");
|
||||
|
||||
Object.defineProperty(exports, "PrimitiveValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_PrimitiveValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ObjectValue = require("./ObjectValue.js");
|
||||
|
||||
Object.defineProperty(exports, "ObjectValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ObjectValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _FunctionValue = require("./FunctionValue.js");
|
||||
|
||||
Object.defineProperty(exports, "FunctionValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_FunctionValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ECMAScriptFunctionValue = require("./ECMAScriptFunctionValue.js");
|
||||
|
||||
Object.defineProperty(exports, "ECMAScriptFunctionValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ECMAScriptFunctionValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ECMAScriptSourceFunctionValue = require("./ECMAScriptSourceFunctionValue.js");
|
||||
|
||||
Object.defineProperty(exports, "ECMAScriptSourceFunctionValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ECMAScriptSourceFunctionValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _BoundFunctionValue = require("./BoundFunctionValue.js");
|
||||
|
||||
Object.defineProperty(exports, "BoundFunctionValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_BoundFunctionValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _NativeFunctionValue = require("./NativeFunctionValue.js");
|
||||
|
||||
Object.defineProperty(exports, "NativeFunctionValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_NativeFunctionValue).default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NativeFunctionCallback", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _NativeFunctionValue.NativeFunctionCallback;
|
||||
}
|
||||
});
|
||||
|
||||
var _ArrayValue = require("./ArrayValue.js");
|
||||
|
||||
Object.defineProperty(exports, "ArrayValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ArrayValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _UndefinedValue = require("./UndefinedValue.js");
|
||||
|
||||
Object.defineProperty(exports, "UndefinedValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_UndefinedValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _EmptyValue = require("./EmptyValue.js");
|
||||
|
||||
Object.defineProperty(exports, "EmptyValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_EmptyValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _NullValue = require("./NullValue.js");
|
||||
|
||||
Object.defineProperty(exports, "NullValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_NullValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _NumberValue = require("./NumberValue.js");
|
||||
|
||||
Object.defineProperty(exports, "NumberValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_NumberValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ProxyValue = require("./ProxyValue.js");
|
||||
|
||||
Object.defineProperty(exports, "ProxyValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ProxyValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _StringExotic = require("./StringExotic.js");
|
||||
|
||||
Object.defineProperty(exports, "StringExotic", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_StringExotic).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ArgumentsExotic = require("./ArgumentsExotic.js");
|
||||
|
||||
Object.defineProperty(exports, "ArgumentsExotic", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ArgumentsExotic).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _IntegerIndexedExotic = require("./IntegerIndexedExotic.js");
|
||||
|
||||
Object.defineProperty(exports, "IntegerIndexedExotic", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_IntegerIndexedExotic).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _BooleanValue = require("./BooleanValue.js");
|
||||
|
||||
Object.defineProperty(exports, "BooleanValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_BooleanValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _StringValue = require("./StringValue.js");
|
||||
|
||||
Object.defineProperty(exports, "StringValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_StringValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _SymbolValue = require("./SymbolValue.js");
|
||||
|
||||
Object.defineProperty(exports, "SymbolValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_SymbolValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _AbstractValue = require("./AbstractValue.js");
|
||||
|
||||
Object.defineProperty(exports, "AbstractValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_AbstractValue).default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "AbstractValueBuildNodeFunction", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _AbstractValue.AbstractValueBuildNodeFunction;
|
||||
}
|
||||
});
|
||||
|
||||
var _AbstractObjectValue = require("./AbstractObjectValue.js");
|
||||
|
||||
Object.defineProperty(exports, "AbstractObjectValue", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_AbstractObjectValue).default;
|
||||
}
|
||||
});
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
build/node_modules/prepack/lib/values/index.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/values/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/values/index.js"],"names":["default","NativeFunctionCallback","AbstractValueBuildNodeFunction"],"mappings":";;;;;;;;;;;0CAWSA,O;;;;;;;;;kDACAA,O;;;;;;;;;mDACAA,O;;;;;;;;;gDACAA,O;;;;;;;;;kDAEAA,O;;;;;;;;;4DACAA,O;;;;;;;;;kEACAA,O;;;;;;;;;uDACAA,O;;;;;;;;;wDACAA,O;;;;;;gCAAgCC,sB;;;;;;;;;+CAEhCD,O;;;;;;;;;mDAEAA,O;;;;;;;;;+CACAA,O;;;;;;;;;8CACAA,O;;;;;;;;;gDAEAA,O;;;;;;;;;+CAEAA,O;;;;;;;;;iDACAA,O;;;;;;;;;oDACAA,O;;;;;;;;;yDACAA,O;;;;;;;;;iDAEAA,O;;;;;;;;;gDACAA,O;;;;;;;;;gDACAA,O;;;;;;;;;kDAEAA,O;;;;;;0BAA0BE,8B;;;;;;;;;wDAC1BF,O","file":"index.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nexport { default as Value } from \"./Value.js\";\nexport { default as ConcreteValue } from \"./ConcreteValue.js\";\nexport { default as PrimitiveValue } from \"./PrimitiveValue.js\";\nexport { default as ObjectValue } from \"./ObjectValue.js\";\n\nexport { default as FunctionValue } from \"./FunctionValue.js\";\nexport { default as ECMAScriptFunctionValue } from \"./ECMAScriptFunctionValue.js\";\nexport { default as ECMAScriptSourceFunctionValue } from \"./ECMAScriptSourceFunctionValue.js\";\nexport { default as BoundFunctionValue } from \"./BoundFunctionValue.js\";\nexport { default as NativeFunctionValue, NativeFunctionCallback } from \"./NativeFunctionValue.js\";\n\nexport { default as ArrayValue } from \"./ArrayValue.js\";\n\nexport { default as UndefinedValue } from \"./UndefinedValue.js\";\nexport { default as EmptyValue } from \"./EmptyValue.js\";\nexport { default as NullValue } from \"./NullValue.js\";\n\nexport { default as NumberValue } from \"./NumberValue.js\";\n\nexport { default as ProxyValue } from \"./ProxyValue.js\";\nexport { default as StringExotic } from \"./StringExotic.js\";\nexport { default as ArgumentsExotic } from \"./ArgumentsExotic.js\";\nexport { default as IntegerIndexedExotic } from \"./IntegerIndexedExotic.js\";\n\nexport { default as BooleanValue } from \"./BooleanValue.js\";\nexport { default as StringValue } from \"./StringValue.js\";\nexport { default as SymbolValue } from \"./SymbolValue.js\";\n\nexport { default as AbstractValue, AbstractValueBuildNodeFunction } from \"./AbstractValue.js\";\nexport { default as AbstractObjectValue } from \"./AbstractObjectValue.js\";\n"]}
|
||||
Reference in New Issue
Block a user