| 511 | |
| 512 | if (tryCatch.StackTrace (localContext).ToLocal (&stackTrace) |
| 513 | && stackTrace->IsString() |
| 514 | && stackTrace.As<v8::String>()->Length() > 0) |
| 515 | { |
| 516 | if (auto st = v8StringToStd (stackTrace); ! st.empty()) |
| 517 | result << std::endl << "Stack trace:" << std::endl << st << std::endl; |
| 518 | } |
| 519 | |
| 520 | return result.str(); |
| 521 | } |
| 522 | |
| 523 | v8::MaybeLocal<v8::Module> loadModule (v8::Local<v8::Context> localContext, v8::Local<v8::String> source) |
| 524 | { |
| 525 | v8::ScriptOrigin origin ({}, 0, 0, false, -1, {}, false, false, true); |
| 526 | v8::ScriptCompiler::Source src (source, origin); |
| 527 | auto mod = v8::ScriptCompiler::CompileModule (isolate, &src); |
| 528 | |
| 529 | if (mod.IsEmpty()) |
| 530 | return {}; |
| 531 | |
| 532 | auto ok = mod.ToLocalChecked()->InstantiateModule (localContext, +[] (v8::Local<v8::Context> c, v8::Local<v8::String> specifier, |
| 533 | v8::Local<v8::FixedArray>, v8::Local<v8::Module>) |
| 534 | { |
| 535 | return getCurrent().loadStaticModule (c, specifier); |
| 536 | }); |
nothing calls this directly
no test coverage detected