8484// function for each built-in modules explicitly in
8585// binding::RegisterBuiltinModules(). This is only forward declaration.
8686// The definitions are in each module's implementation when calling
87- // the NODE_BUILTIN_MODULE_CONTEXT_AWARE .
87+ // the NODE_MODULE_CONTEXT_AWARE_INTERNAL .
8888#define V (modname ) void _register_##modname();
8989NODE_BUILTIN_MODULES (V)
9090#undef V
@@ -101,7 +101,6 @@ using v8::String;
101101using v8::Value;
102102
103103// Globals per process
104- static node_module* modlist_builtin;
105104static node_module* modlist_internal;
106105static node_module* modlist_linked;
107106static node_module* modlist_addon;
@@ -114,10 +113,7 @@ bool node_is_initialized = false;
114113extern " C" void node_module_register (void * m) {
115114 struct node_module * mp = reinterpret_cast <struct node_module *>(m);
116115
117- if (mp->nm_flags & NM_F_BUILTIN) {
118- mp->nm_link = modlist_builtin;
119- modlist_builtin = mp;
120- } else if (mp->nm_flags & NM_F_INTERNAL) {
116+ if (mp->nm_flags & NM_F_INTERNAL) {
121117 mp->nm_link = modlist_internal;
122118 modlist_internal = mp;
123119 } else if (!node_is_initialized) {
@@ -295,11 +291,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
295291 env->ThrowError (errmsg);
296292 return false ;
297293 }
298- if (mp->nm_flags & NM_F_BUILTIN) {
299- dlib->Close ();
300- env->ThrowError (" Built-in module self-registered." );
301- return false ;
302- }
294+ CHECK_EQ (mp->nm_flags & NM_F_BUILTIN, 0 );
303295
304296 mp->nm_dso_handle = dlib->handle_ ;
305297 mp->nm_link = modlist_addon;
@@ -335,9 +327,6 @@ inline struct node_module* FindModule(struct node_module* list,
335327 return mp;
336328}
337329
338- node_module* get_builtin_module (const char * name) {
339- return FindModule (modlist_builtin, name, NM_F_BUILTIN);
340- }
341330node_module* get_internal_module (const char * name) {
342331 return FindModule (modlist_internal, name, NM_F_INTERNAL);
343332}
@@ -363,25 +352,6 @@ static void ThrowIfNoSuchModule(Environment* env, const char* module_v) {
363352 env->ThrowError (errmsg);
364353}
365354
366- void GetBinding (const FunctionCallbackInfo<Value>& args) {
367- Environment* env = Environment::GetCurrent (args);
368-
369- CHECK (args[0 ]->IsString ());
370-
371- Local<String> module = args[0 ].As <String>();
372- node::Utf8Value module_v (env->isolate (), module );
373-
374- node_module* mod = get_builtin_module (*module_v);
375- Local<Object> exports;
376- if (mod != nullptr ) {
377- exports = InitModule (env, mod, module );
378- } else {
379- return ThrowIfNoSuchModule (env, *module_v);
380- }
381-
382- args.GetReturnValue ().Set (exports);
383- }
384-
385355void GetInternalBinding (const FunctionCallbackInfo<Value>& args) {
386356 Environment* env = Environment::GetCurrent (args);
387357
0 commit comments