Skip to content

Commit

Permalink
fix(client): Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
xLuxy committed Sep 10, 2024
1 parent 4d98df5 commit 03a4e71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion client/src/helpers/IModuleHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,18 @@ v8::Local<v8::Module> IModuleHandler::CompileSyntheticModule(const std::string&

IModuleHandler::PersistentSyntheticModuleExports persistentExports;
std::vector<v8::Local<v8::String>> exportKeys;

exportKeys.reserve(exports.size());
persistentExports.reserve(exports.size());

for(const auto& [key, value] : exports)
{
exportKeys.push_back(js::JSValue(key));
persistentExports.insert({ key, js::Persistent<v8::Value>(isolate, value) });
}

v8::Local<v8::Module> module = v8::Module::CreateSyntheticModule(isolate, js::JSValue(name), exportKeys, SyntheticModuleEvaluateCallback);
v8::MemorySpan<const v8::Local<v8::String>> values(exportKeys.data(), exportKeys.size());
v8::Local<v8::Module> module = v8::Module::CreateSyntheticModule(isolate, js::JSValue(name), values, SyntheticModuleEvaluateCallback);

syntheticModuleExports.insert({ module->GetIdentityHash(), persistentExports });
return module;
Expand Down
4 changes: 2 additions & 2 deletions shared/src/helpers/CallContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace js

bool CheckExtraInternalFieldJSValue()
{
return Check(!info.This()->GetInternalField(1)->IsNullOrUndefined(), "Invalid extra internal field value");
return Check(!info.This()->GetInternalField(1).As<v8::Value>()->IsNullOrUndefined(), "Invalid extra internal field value");
}

v8::Local<v8::Object> GetThis()
Expand Down Expand Up @@ -131,7 +131,7 @@ namespace js
{
if(errored) return {};
if(info.This()->InternalFieldCount() != 2) return {};
std::optional<T> value = CppValue<T>(info.This()->GetInternalField(1));
std::optional<T> value = CppValue<T>(info.This()->GetInternalField(1).As<v8::Value>());
if(!value.has_value()) return T{};
return value.value();
}
Expand Down

0 comments on commit 03a4e71

Please sign in to comment.