UNPKG

prepack

Version:

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

46 lines (34 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _index = require("../../values/index.js"); var _singletons = require("../../singletons.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, obj) { // ECMA262 19.3.1 obj.$BooleanData = realm.intrinsics.false; const tsTemplateSrc = "('' + A)"; // ECMA262 19.3.3.3 obj.defineNativeMethod("toString", 0, context => { const target = context instanceof _index.ObjectValue ? context.$BooleanData : context; if (target instanceof _index.AbstractValue && target.getType() === _index.BooleanValue) { return _index.AbstractValue.createFromTemplate(realm, tsTemplateSrc, _index.StringValue, [target]); } // 1. Let b be ? thisBooleanValue(this value). let b = _singletons.To.thisBooleanValue(realm, context); // 2. If b is true, return "true"; else return "false". return new _index.StringValue(realm, b.value ? "true" : "false"); }); // ECMA262 19.3.3.4 obj.defineNativeMethod("valueOf", 0, context => { // 1. Return ? thisBooleanValue(this value). return _singletons.To.thisBooleanValue(realm, context); }); } //# sourceMappingURL=BooleanPrototype.js.map