84
84
// function for each built-in modules explicitly in
85
85
// binding::RegisterBuiltinModules(). This is only forward declaration.
86
86
// The definitions are in each module's implementation when calling
87
- // the NODE_BUILTIN_MODULE_CONTEXT_AWARE .
87
+ // the NODE_MODULE_CONTEXT_AWARE_INTERNAL .
88
88
#define V (modname ) void _register_##modname();
89
89
NODE_BUILTIN_MODULES (V)
90
90
#undef V
@@ -101,7 +101,6 @@ using v8::String;
101
101
using v8::Value;
102
102
103
103
// Globals per process
104
- static node_module* modlist_builtin;
105
104
static node_module* modlist_internal;
106
105
static node_module* modlist_linked;
107
106
static node_module* modlist_addon;
@@ -114,10 +113,7 @@ bool node_is_initialized = false;
114
113
extern " C" void node_module_register (void * m) {
115
114
struct node_module * mp = reinterpret_cast <struct node_module *>(m);
116
115
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) {
121
117
mp->nm_link = modlist_internal;
122
118
modlist_internal = mp;
123
119
} else if (!node_is_initialized) {
@@ -295,11 +291,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
295
291
env->ThrowError (errmsg);
296
292
return false ;
297
293
}
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 );
303
295
304
296
mp->nm_dso_handle = dlib->handle_ ;
305
297
mp->nm_link = modlist_addon;
@@ -335,9 +327,6 @@ inline struct node_module* FindModule(struct node_module* list,
335
327
return mp;
336
328
}
337
329
338
- node_module* get_builtin_module (const char * name) {
339
- return FindModule (modlist_builtin, name, NM_F_BUILTIN);
340
- }
341
330
node_module* get_internal_module (const char * name) {
342
331
return FindModule (modlist_internal, name, NM_F_INTERNAL);
343
332
}
@@ -363,25 +352,6 @@ static void ThrowIfNoSuchModule(Environment* env, const char* module_v) {
363
352
env->ThrowError (errmsg);
364
353
}
365
354
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
-
385
355
void GetInternalBinding (const FunctionCallbackInfo<Value>& args) {
386
356
Environment* env = Environment::GetCurrent (args);
387
357
0 commit comments