Move generateObjectModuleSourceCode to separate file to fix build error

This commit is contained in:
Jarred Sumner
2022-09-05 05:16:21 -07:00
parent c31422b308
commit d2397b60e7
2 changed files with 31 additions and 24 deletions

View File

@@ -0,0 +1,29 @@
#include "ObjectModule.h"
namespace Zig {
JSC::SyntheticSourceProvider::SyntheticSourceGenerator
generateObjectModuleSourceCode(JSC::JSGlobalObject *globalObject,
JSC::JSObject *object) {
JSC::VM &vm = globalObject->vm();
return [object](JSC::JSGlobalObject *lexicalGlobalObject,
JSC::Identifier moduleKey,
Vector<JSC::Identifier, 4> &exportNames,
JSC::MarkedArgumentBuffer &exportValues) -> void {
JSC::VM &vm = lexicalGlobalObject->vm();
GlobalObject *globalObject =
reinterpret_cast<GlobalObject *>(lexicalGlobalObject);
JSC::EnsureStillAliveScope stillAlive(object);
PropertyNameArray properties(vm, PropertyNameMode::Strings,
PrivateSymbolMode::Exclude);
object->getPropertyNames(globalObject, properties,
DontEnumPropertiesMode::Exclude);
for (auto &entry : properties) {
exportNames.append(entry);
exportValues.append(object->get(globalObject, entry));
}
};
}
} // namespace Zig