diff --git a/src/core.js b/src/core.js index d8efa4fc..fce2b5bf 100644 --- a/src/core.js +++ b/src/core.js @@ -560,7 +560,7 @@ Sequence.prototype._finally = function Sequence$finally(other){ return this._transform(new FinallyAction(other)); }; -Sequence.prototype._fork = interpretor(Sequence); +Sequence.prototype._fork = interpretor; Sequence.prototype.toString = function Sequence$toString(){ return `${this._spawn.toString()}${this._actions.map(x => `.${x.toString()}`).join('')}`; diff --git a/src/internal/interpretor.js b/src/internal/interpretor.js index 3379924c..75b15eef 100644 --- a/src/internal/interpretor.js +++ b/src/internal/interpretor.js @@ -3,7 +3,7 @@ import Denque from 'denque'; import {noop} from './fn'; -export default Sequence => function interpretor(rej, res){ +export default function interpretor(rej, res){ //This is the primary queue of actions. All actions in here will be "cold", //meaning they haven't had the chance yet to run concurrent computations. @@ -29,7 +29,7 @@ export default Sequence => function interpretor(rej, res){ function settle(m){ settled = true; future = m; - if(future instanceof Sequence){ + if(future._spawn){ for(let i = future._actions.length - 1; i >= 0; i--) cold.unshift(future._actions[i]); future = future._spawn; } @@ -123,4 +123,4 @@ export default Sequence => function interpretor(rej, res){ while(it = queue.shift()) it.cancel(); }; -}; +}