Skip to content

Commit

Permalink
src: use supported API to get stalled TLA messages
Browse files Browse the repository at this point in the history
Refs: v8/v8@23e3b6f
PR-URL: #51362
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
  • Loading branch information
targos committed Mar 31, 2024
1 parent d34b02d commit d248639
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ 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_messages =
std::get<1>(module->GetStalledTopLevelAwaitMessages(isolate));
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 +614,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_messages =
std::get<1>(module->GetStalledTopLevelAwaitMessages(isolate));
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 d248639

Please sign in to comment.