Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 9d4f3ca

Browse files
committed
remove setter conditionals, adjust tests
1 parent 3dec460 commit 9d4f3ca

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

lib/loader.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -691,13 +691,8 @@ function logloads(loads) {
691691

692692
for (var i = 0, l = module.importers.length; i < l; i++) {
693693
var importerModule = module.importers[i];
694-
if (importerModule.setters) {
695-
var importerIndex = importerModule.dependencies.indexOf(module);
696-
if (importerIndex != -1) {
697-
var setter = importerModule.setters[importerIndex];
698-
setter(moduleObj);
699-
}
700-
}
694+
var importerIndex = importerModule.dependencies.indexOf(module);
695+
importerModule.setters[importerIndex](moduleObj);
701696
}
702697
return value;
703698
});
@@ -712,8 +707,6 @@ function logloads(loads) {
712707
var depName = load.dependencies[i].value;
713708
var depModule = getOrCreateModuleRecord(depName);
714709

715-
depModule.importers.push(module);
716-
717710
// if not already a module in the registry, try and link it now
718711
if (!loader.modules[depName]) {
719712

@@ -731,6 +724,7 @@ function logloads(loads) {
731724
console.assert(depModule, 'Dependency module not found!');
732725

733726
module.dependencies.push(depModule);
727+
depModule.importers.push(module);
734728

735729
// run the setter for this dependency
736730
if (module.setters[i])

test/syntax/circular2.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import {fn1, variable1} from './circular1';
22

33
export var variable2 = 'test circular 2';
44

5+
export { output as output1 } from './circular1';
6+
57
fn1();
68

79
export var output;

test/syntax/even.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ export var counter = 0;
55
export function even(n) {
66
counter++;
77
return n == 0 || odd(n - 1);
8-
}
8+
}
9+
10+
odd(1);

test/test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ function runTests() {
211211
System['import']('syntax/circular2').then(function(m2) {
212212
assert(
213213
[m2.output, 'test circular 1'],
214-
[m1.output, 'test circular 2']
214+
[m1.output, 'test circular 2'],
215+
[m2.output1, 'test circular 2']
215216
);
216217
}, err);
217218
}, err);
@@ -221,9 +222,9 @@ function runTests() {
221222
System['import']('syntax/even').then(function(m) {
222223
assert(
223224
[m.even(10), true],
224-
[m.counter, 6],
225+
[m.counter, 7],
225226
[m.even(15), false],
226-
[m.counter, 14]
227+
[m.counter, 15]
227228
);
228229
}, err);
229230
});

0 commit comments

Comments
 (0)