diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-10-27 01:43:51 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-11-03 01:10:31 +0100 |
commit | e22a8f17a5d70355062b483337692e45954380a0 (patch) | |
tree | 054e2fe3fca52a86e8ddcc98879052bc9674f804 /src/node_url.h | |
parent | 89b3228f4d1a7f00b8ff195964895061e45861d1 (diff) | |
download | android-node-v8-e22a8f17a5d70355062b483337692e45954380a0.tar.gz android-node-v8-e22a8f17a5d70355062b483337692e45954380a0.tar.bz2 android-node-v8-e22a8f17a5d70355062b483337692e45954380a0.zip |
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/node_url.h')
-rw-r--r-- | src/node_url.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node_url.h b/src/node_url.h index 872f2fbc97..6b526d15b0 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -118,6 +118,9 @@ class URL { URL(std::string input, const URL* base) : URL(input.c_str(), input.length(), base) {} + URL(std::string input, const URL& base) : + URL(input.c_str(), input.length(), &base) {} + URL(std::string input, std::string base) : URL(input.c_str(), input.length(), base.c_str(), base.length()) {} @@ -168,6 +171,13 @@ class URL { const Local<Value> ToObject(Environment* env) const; + URL(const URL&) = default; + URL& operator=(const URL&) = default; + URL(URL&&) = default; + URL& operator=(URL&&) = default; + + URL() : URL("") {} + private: struct url_data context_; }; |