vm: flip Module#link's signature

The specifier parameter is deemed to be more essential than
referencingModule. Flipping the parameter order allows developers to
write simple linker functions that only take in a specifier.

PR-URL: https://github.com/nodejs/node/pull/18471
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Gus Caplan 2018-01-30 23:03:56 -06:00 committed by Timothy Gu
parent f8fda0d5ad
commit 6d84ecefcd
No known key found for this signature in database
GPG key ID: 7FE6B095B582B0D4
4 changed files with 9 additions and 10 deletions

View file

@ -109,7 +109,7 @@ async function checkModuleState() {
{
const m = new Module('import "foo";');
await m.link(common.mustCall(async (module, specifier) => {
await m.link(common.mustCall(async (specifier, module) => {
assert.strictEqual(module, m);
assert.strictEqual(specifier, 'foo');
assert.strictEqual(m.linkingStatus, 'linking');