This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We model the call stack using a linked list of Generators | |
// Each Generator has a _return field pointing back to its parent | |
function stepGen(gen, arg) { | |
const {done, value} = gen.next(arg) | |
if(done) { | |
if(gen._return) { | |
stepGen(gen._return, value) | |
} |