diff options
author | Gus Caplan <me@gus.host> | 2018-01-30 23:03:56 -0600 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2018-02-03 11:04:34 -0800 |
commit | 6d84ecefcd7da51ee5f9613f745ba5d0a9818726 (patch) | |
tree | 03249c6fdd9fab8ef4d02e28c45252aa91286ad0 /test | |
parent | f8fda0d5ada6e391941b328f98e429e51a05ffda (diff) | |
download | android-node-v8-6d84ecefcd7da51ee5f9613f745ba5d0a9818726.tar.gz android-node-v8-6d84ecefcd7da51ee5f9613f745ba5d0a9818726.tar.bz2 android-node-v8-6d84ecefcd7da51ee5f9613f745ba5d0a9818726.zip |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-vm-module-errors.js | 2 | ||||
-rw-r--r-- | test/parallel/test-vm-module-link.js | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index 8bcb101ccc..1c7e01cf30 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -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'); diff --git a/test/parallel/test-vm-module-link.js b/test/parallel/test-vm-module-link.js index 870427e91b..843c1fdc51 100644 --- a/test/parallel/test-vm-module-link.js +++ b/test/parallel/test-vm-module-link.js @@ -18,7 +18,7 @@ async function simple() { assert.deepStrictEqual(bar.dependencySpecifiers, ['foo']); - await bar.link(common.mustCall((module, specifier) => { + await bar.link(common.mustCall((specifier, module) => { assert.strictEqual(module, bar); assert.strictEqual(specifier, 'foo'); return foo; @@ -38,7 +38,7 @@ async function depth() { import ${parentName} from '${parentName}'; export default ${parentName}; `); - await mod.link(common.mustCall((module, specifier) => { + await mod.link(common.mustCall((specifier, module) => { assert.strictEqual(module, mod); assert.strictEqual(specifier, parentName); return parentModule; @@ -68,10 +68,10 @@ async function circular() { return foo; } `); - await foo.link(common.mustCall(async (fooModule, fooSpecifier) => { + await foo.link(common.mustCall(async (fooSpecifier, fooModule) => { assert.strictEqual(fooModule, foo); assert.strictEqual(fooSpecifier, 'bar'); - await bar.link(common.mustCall((barModule, barSpecifier) => { + await bar.link(common.mustCall((barSpecifier, barModule) => { assert.strictEqual(barModule, bar); assert.strictEqual(barSpecifier, 'foo'); assert.strictEqual(foo.linkingStatus, 'linking'); @@ -111,7 +111,7 @@ async function circular2() { }; const moduleMap = new Map(); const rootModule = new Module(sourceMap.root, { url: 'vm:root' }); - async function link(referencingModule, specifier) { + async function link(specifier, referencingModule) { if (moduleMap.has(specifier)) { return moduleMap.get(specifier); } |