Home Reference Source

lib/solidity/sagas/index.js

  1. import debugModule from "debug";
  2. const debug = debugModule("debugger:solidity:sagas");
  3.  
  4. import { call, put, take, select } from "redux-saga/effects";
  5. import { prefixName } from "lib/helpers";
  6.  
  7. import * as actions from "../actions";
  8. import { TICK } from "lib/trace/actions";
  9.  
  10. import solidity from "../selectors";
  11.  
  12. export function *addSource(source, sourcePath, ast) {
  13. yield put(actions.addSource(source, sourcePath, ast));
  14. }
  15.  
  16. export function *addSourceMap(binary, sourceMap) {
  17. yield put(actions.addSourceMap(binary, sourceMap));
  18. }
  19.  
  20. function* functionDepthSaga () {
  21. while (true) {
  22. yield take(TICK);
  23. debug("got TICK");
  24. let instruction = yield select(solidity.current.instruction);
  25. debug("instruction: %o", instruction);
  26.  
  27. if (yield select(solidity.current.willJump)) {
  28. let jumpDirection = yield select(solidity.current.jumpDirection);
  29.  
  30.  
  31. yield put(actions.jump(jumpDirection));
  32. }
  33. }
  34. }
  35.  
  36. export function* saga () {
  37. yield call(functionDepthSaga);
  38. }
  39.  
  40. export default prefixName("solidity", saga);