Create switch instruction
We aim at moving the dispatch code to codegen. It means we'll need new instructions and builtin structs there, like the switch instruction, utilized in this line.
This PR wires up the switch instruction for that and enables the code generation for switch statements in Yul, using the newly added instruction.
LGTM, although it could use some more tests (e.g. no cases and no default at all, multiple default cases, duplicate cases, etc...)
no cases and no default at all,The parser does not allow that. You can have only no cases and a default block and cases without a default. There is a test missing for the former. I'm going to add that.multiple default casesThe parser does not accept that.duplicate cases. This is missing. Good point
I'll add those tests!
LGTM, although it could use some more tests (e.g. no cases and no default at all, multiple default cases, duplicate cases, etc...)
no cases and no default at all,The parser does not allow that. You can have only no cases and a default block and cases without a default. There is a test missing for the former. I'm going to add that.multiple default casesThe parser does not accept that.duplicate cases. This is missing. Good pointI'll add those tests!
For the #3, that is a semantic error that I was not detecting.
@seanyoung and @xermicus I am requesting your review again as I implemented Cyrill's suggestions.