trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.31k forks source link

Refactor switch statement in debugger's data sagas #4052

Open gnidan opened 3 years ago

gnidan commented 3 years ago

We should really refactor this switch statement. Thought that just occurred to me: something like this:

for (const { nodeType, predicate, saga } of sagaConditions) {
  if (node.nodeType !== nodeType) {
    continue;
  }

  if (!(yield* predicate())) {
    continue;
  }

  yield* saga();
  break;
}

Then you'd could have a lot of flexibility on how you want to specify sagaConditions - eventually they might span modules or we could factor out commonalities?

Anyway, just a thought. If you're interested, maybe it's worth making an issue from this comment.

_Originally posted by @gnidan in https://github.com/trufflesuite/truffle/pull/4015#discussion_r635672033_

Rishabhraghwendra18 commented 3 years ago

@fainashalts may I work on this issue ?