Browse Source

Merge pull request #427 from rollup/gh-425

prevent stack overflow with mutual strong dependencies – fixes #425
gh-669
Rich Harris 9 years ago
parent
commit
45ab79bddb
  1. 1
      src/Bundle.js
  2. 3
      test/function/cycles-stack-overflow/_config.js
  3. 11
      test/function/cycles-stack-overflow/b.js
  4. 13
      test/function/cycles-stack-overflow/c.js
  5. 12
      test/function/cycles-stack-overflow/d.js
  6. 3
      test/function/cycles-stack-overflow/main.js

1
src/Bundle.js

@ -360,7 +360,6 @@ export default class Bundle {
});
}
return ordered;
}
}

3
test/function/cycles-stack-overflow/_config.js

@ -0,0 +1,3 @@
module.exports = {
description: 'does not stack overflow on crazy cyclical dependencies'
};

11
test/function/cycles-stack-overflow/b.js

@ -0,0 +1,11 @@
import { C } from './c.js';
export function B () {};
B.prototype = {
c: function () {
return function () {
new C();
};
}()
};

13
test/function/cycles-stack-overflow/c.js

@ -0,0 +1,13 @@
import { D } from './d.js';
export function C () {
this.x = 'x';
}
C.prototype = {
d: function () {
return function () {
new D();
};
}()
};

12
test/function/cycles-stack-overflow/d.js

@ -0,0 +1,12 @@
import { B } from './b.js';
import { C } from './c.js';
export function D () {};
D.prototype = {
c: function () {
return function () {
new C();
};
}()
};

3
test/function/cycles-stack-overflow/main.js

@ -0,0 +1,3 @@
import { C } from './c.js';
assert.equal( new C().x, 'x' );
Loading…
Cancel
Save