Skip to content

Commit

Permalink
Merge pull request #65 from oven-sh/dylan/exception-from-unlinked-mod…
Browse files Browse the repository at this point in the history
…ule-code-block

handle exceptions in `ModuleProgramExecutable::create`
  • Loading branch information
Jarred-Sumner authored Aug 28, 2024
2 parents 3e6ea14 + 52f6628 commit 3f9ba9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions Source/JavaScriptCore/runtime/JSModuleRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ Synchronousness JSModuleRecord::link(JSGlobalObject* globalObject, JSValue scrip

ModuleProgramExecutable* executable = ModuleProgramExecutable::create(globalObject, sourceCode());
EXCEPTION_ASSERT(!!scope.exception() == !executable);
if (!executable) {
throwSyntaxError(globalObject, scope);
return Synchronousness::Sync;
}
RETURN_IF_EXCEPTION(scope, Synchronousness::Sync);

instantiateDeclarations(globalObject, executable, scriptFetcher);
RETURN_IF_EXCEPTION(scope, Synchronousness::Sync);
m_moduleProgramExecutable.set(vm, this, executable);
Expand Down
4 changes: 3 additions & 1 deletion Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ ModuleProgramExecutable* ModuleProgramExecutable::create(JSGlobalObject* globalO
VM& vm = globalObject->vm();
ModuleProgramExecutable* executable = new (NotNull, allocateCell<ModuleProgramExecutable>(vm)) ModuleProgramExecutable(globalObject, source);
executable->finishCreation(vm);
executable->getUnlinkedCodeBlock(globalObject); // This generates and binds unlinked code block.
// This generates and binds unlinked code block.
if (!executable->getUnlinkedCodeBlock(globalObject))
return nullptr;
return executable;
}

Expand Down

0 comments on commit 3f9ba9b

Please sign in to comment.