Skip to content

Commit

Permalink
Replace deprecated Module::GetStalledTopLevelAwaitMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
pthier committed Mar 21, 2024
1 parent 4070bd1 commit 25196a6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,14 @@ v8::Maybe<bool> ModuleWrap::CheckUnsettledTopLevelAwait() {
if (!module->IsGraphAsync()) { // There is no TLA, no need to check.
return v8::Just(true);
}
auto stalled = module->GetStalledTopLevelAwaitMessage(isolate);
if (stalled.size() == 0) {
auto stalled = module->GetStalledTopLevelAwaitMessages(isolate);
auto stalled_messages = std::get<1>(stalled);
if (stalled_messages.size() == 0) {
return v8::Just(true);
}

if (env()->options()->warnings) {
for (auto pair : stalled) {
Local<v8::Message> message = std::get<1>(pair);

for (auto message : stalled_messages) {
std::string reason = "Warning: Detected unsettled top-level await at ";
std::string info =
FormatErrorMessage(isolate, context, "", message, true);
Expand Down Expand Up @@ -614,11 +613,10 @@ void ModuleWrap::EvaluateSync(const FunctionCallbackInfo<Value>& args) {

if (module->IsGraphAsync()) {
CHECK(env->options()->print_required_tla);
auto stalled = module->GetStalledTopLevelAwaitMessage(isolate);
if (stalled.size() != 0) {
for (auto pair : stalled) {
Local<v8::Message> message = std::get<1>(pair);

auto stalled = module->GetStalledTopLevelAwaitMessages(isolate);
auto stalled_messages = std::get<1>(stalled);
if (stalled_messages.size() != 0) {
for (auto message : stalled_messages) {
std::string reason = "Error: unexpected top-level await at ";
std::string info =
FormatErrorMessage(isolate, context, "", message, true);
Expand Down

0 comments on commit 25196a6

Please sign in to comment.