prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
40 lines (31 loc) • 1.04 kB
JavaScript
;
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 */
// ECMA262 12.2.9
function _default(ast, strictCode, env, realm) {
let str = "";
for (let i = 0; i < ast.quasis.length; i++) {
// add quasi
let elem = ast.quasis[i];
str += elem.value.cooked; // add expression
let expr = ast.expressions[i];
if (expr) {
str += _singletons.To.ToStringPartial(realm, _singletons.Environment.GetValue(realm, env.evaluate(expr, strictCode)));
}
}
return new _index.StringValue(realm, str);
}
//# sourceMappingURL=TemplateLiteral.js.map