Skip to content

Commit

Permalink
module: return correct exports from linked binding
Browse files Browse the repository at this point in the history
Method `LinkedBinding` must return the same "exports" property
of the module as cached, because property can be overridden
by an initialization function.

PR-URL: #5337
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
Phillip Kovalev authored and bnoordhuis committed Feb 20, 2016
1 parent 91f6bc0 commit 5c14efb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2450,9 +2450,10 @@ static void LinkedBinding(const FunctionCallbackInfo<Value>& args) {
return env->ThrowError("Linked module has no declared entry point.");
}

cache->Set(module_name, module->Get(exports_prop));
auto effective_exports = module->Get(exports_prop);
cache->Set(module_name, effective_exports);

args.GetReturnValue().Set(exports);
args.GetReturnValue().Set(effective_exports);
}

static void ProcessTitleGetter(Local<String> property,
Expand Down

0 comments on commit 5c14efb

Please sign in to comment.