Simplify module loading code

refactor(core): simplify module loading code (#10385)
Simplify module loading coderefactorsimplify module loading code core

Committed by bartlomieju

commit message
refactor(core): simplify module loading code (#10385)

General cleanup of module loading code, tried to reduce indentation in various methods
on "JsRuntime" to improve readability.
 
Added "JsRuntime::handle_scope" helper function, which returns a "v8::HandleScope".
This was done to reduce a code pattern that happens all over the "deno_core".
 
Additionally if event loop hangs during loading of dynamic modules a list of
currently pending dynamic imports is printed.

Editor assessment

The subject states the goal plainly: module loading code simplified. The body earns its place with concrete content: reduced indentation across JsRuntime methods, a new handle_scope helper replacing a repeated v8 pattern, and pending dynamic imports printed when the loop hangs. That is mechanism and rationale together. Type refactor and scope core are accurate. No footers beyond the PR number. A substantive message whose body teaches the cleanup's shape.

Browse categories

More refactor examples · Back to search