Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-10-27 02:43:51 +0300
committerAnna Henningsen <anna@addaleax.net>2017-11-03 03:10:31 +0300
commite22a8f17a5d70355062b483337692e45954380a0 (patch)
tree054e2fe3fca52a86e8ddcc98879052bc9674f804 /src/module_wrap.h
parent89b3228f4d1a7f00b8ff195964895061e45861d1 (diff)
src: improve module loader readability
Various improvements on readability, performance and conformity to the Node core coding style in the ESM loader C++ code: - `isolate` for the `Isolate*`, `context` for the `Local<Context>` - Less reliance on `auto` where it’s unnecessary/increases cognitive overhead - Shorter paths to failure via `.ToLocal()` & co - Do not keep pending exceptions around e.g. for failed `JSON` parsing - Use `Maybe` types to get explicit error status forwarding - Remove an unnecessary handle scope - Add `nullptr` checks for unwrapped host objects - Remove unused code - Use `CamelCase` for function names - Use `const Foo&` instead of copying values whenever possible - Pass along the `Environment*` explicitly PR-URL: https://github.com/nodejs/node/pull/16536 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'src/module_wrap.h')
-rw-r--r--src/module_wrap.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/module_wrap.h b/src/module_wrap.h
index e0f7ce5bd2d..980c802c1f1 100644
--- a/src/module_wrap.h
+++ b/src/module_wrap.h
@@ -12,8 +12,10 @@
namespace node {
namespace loader {
-node::url::URL Resolve(std::string specifier, const node::url::URL* base,
- bool read_pkg_json = false);
+v8::Maybe<url::URL> Resolve(Environment* env,
+ const std::string& specifier,
+ const url::URL& base,
+ bool read_pkg_json = false);
class ModuleWrap : public BaseObject {
public:
@@ -23,7 +25,7 @@ class ModuleWrap : public BaseObject {
v8::Local<v8::Context> context);
private:
- ModuleWrap(node::Environment* env,
+ ModuleWrap(Environment* env,
v8::Local<v8::Object> object,
v8::Local<v8::Module> module,
v8::Local<v8::String> url);