UNPKG

prepack

Version:

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

41 lines (31 loc) 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _index = require("../../values/index.js"); var _singletons = require("../../singletons.js"); var _generator = require("../../utils/generator.js"); /** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ /* strict-local */ function _default(realm) { // ECMA262 22.1.3.30 return new _index.NativeFunctionValue(realm, "Array.prototype.values", "values", 0, context => { // 1. Let O be ? ToObject(this value). let O = _singletons.To.ToObject(realm, context); // If we have an object that is an array with widened numeric properties, then // we can return a temporal here as we know nothing of the array's properties. // This should be safe to do, as we never expose the internals of the array. if (_index.ArrayValue.isIntrinsicAndHasWidenedNumericProperty(O) && realm.isInPureScope() && O.$GetOwnProperty("values") === undefined) { return _index.AbstractValue.createTemporalFromBuildFunction(realm, _index.Value, [O, new _index.StringValue(realm, "values")], (0, _generator.createOperationDescriptor)("UNKNOWN_ARRAY_METHOD_PROPERTY_CALL")); } // 2. Return CreateArrayIterator(O, "value"). return _singletons.Create.CreateArrayIterator(realm, O.throwIfNotConcreteObject(), "value"); }); } //# sourceMappingURL=ArrayProto_values.js.map