Files
asciidisco.com/build/node_modules/prepack/lib/evaluators/ClassExpression.js
2023-08-01 13:49:46 +02:00

42 lines
1.3 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (ast, strictCode, env, realm) {
// 1. If BindingIdentifieropt is not present, let className be undefined.
var className = void 0;
// 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.
var 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").
var 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