UNPKG

prepack

Version:

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

51 lines (38 loc) 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _index = require("../methods/index.js"); var _ClassDeclaration = require("./ClassDeclaration"); 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 14.5.16 function _default(ast, strictCode, env, realm) { // 1. If BindingIdentifieropt is not present, let className be undefined. let className; // 2. Else, let className be StringValue of BindingIdentifier. if (ast.id != null) { className = ast.id.name; } // 3. Let value be the result of ClassDefinitionEvaluation of ClassTail with argument className. let value = (0, _ClassDeclaration.ClassDefinitionEvaluation)(realm, ast, className, strictCode, env); // 4. ReturnIfAbrupt(value). // 5. If className is not undefined, then if (className !== undefined) { // a. Let hasNameProperty be HasOwnProperty(value, "name"). let hasNameProperty = (0, _index.HasOwnProperty)(realm, value, "name"); // b. ReturnIfAbrupt(hasNameProperty). // c. If hasNameProperty is false, then if (!hasNameProperty) { // i. Perform SetFunctionName(value, className). _singletons.Functions.SetFunctionName(realm, value, className); } } // 6. Return NormalCompletion(value). return value; } //# sourceMappingURL=ClassExpression.js.map