prepack
Version:
Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.
42 lines (32 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (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) {
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) {
// 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;
};
var _index = require("../methods/index.js");
var _ClassDeclaration = require("./ClassDeclaration");
var _singletons = require("../singletons.js");
//# sourceMappingURL=ClassExpression.js.map