} function *walkSaga({sourceId, ast}) { yield walk(sourceId, ast); } export function *visitAll(idx) { let sources = yield select(ast.views.sources); let tasks = yield all( Object.entries(sources) .filter( ([id, {ast}]) => !!ast ) .map( ([id, {ast}]) => fork( () => put(actions.visit(id, ast))) ) ) if (tasks.length > 0) { yield join(...tasks); } yield put(actions.doneVisiting()); } export function* saga() { yield race({ visitor: takeEvery(actions.VISIT, walkSaga), done: take(actions.DONE_VISITING) }); } export default prefixName("ast", saga);
debug("waiting for trace EOT"); // wait until trace hits EOT yield *trace.wait(); debug("finishing"); // finish yield put(actions.finish()); } debug("stopping listeners"); yield all( listeners.map(task => cancel(task)) ); } export default prefixName("session", saga); function *forkListeners() { return yield all( [ast, controller, data, evm, solidity, trace, web3] .map( app => fork(app.saga) ) ); } function* fetchTx(txHash, provider) { let result = yield *web3.inspectTransaction(txHash, provider); if (result.error) { return result.error; }
yield put(actions.tock()); debug("put TOCK"); } else { yield put(actions.endTrace()); } } export function* wait() { yield take(actions.END_OF_TRACE); } export function *processTrace(trace) { yield put(actions.saveSteps(trace)); let {addresses} = yield take(actions.RECEIVE_ADDRESSES); debug("received addresses"); return addresses; } export function* saga() { // wait for trace to be defined yield *waitForTrace(); yield takeEvery(actions.NEXT, next); } export default prefixName("trace", saga);
while (true) { debug("waiting for control action"); let action = yield take(Object.keys(CONTROL_SAGAS)); debug("got control action"); let saga = CONTROL_SAGAS[action.type]; yield put(actions.beginStep(action.type)); yield race({ exec: call(saga, action), interrupt: take(actions.INTERRUPT) }); } } export default prefixName("controller", saga); /** * Advance the state by one instruction */ function* advance() { // send action to advance trace yield *trace.advance(); } /** * stepNext - step to the next logical code segment * * Note: It might take multiple instructions to express the same section of code. * "Stepping", then, is stepping to the next logical item, not stepping to the next * instruction. See advance() if you'd like to advance by one instruction.