|
On 2019-12-23 12:47 p.m., Bas Groothedde wrote:
I'd like to have the ability to convert, say: switch (op) { case OP_TAILCALL: { ... /*fallthrough*/ } case OP_CALL: { ... break; } } into: if op == OP_TAILCALL then ... -- fallthrough orif op == OP_CALL then ... end because it looks nicer this way I guess.My apologies, I see what you mean now. Basically if op == OP_TAILCALL or op == OP_CALL, but in separate statements. In that particular case, I would rather see a switch-case statement in Lua.~Bas
switch-case is garbage, this is a lot more powerful because the condition can be arbitrary. jump tables are just an optimization that doesn't need to rely on switch-case to exist. (in fact oftentimes switch-case gets "deoptimized" into if-elseif-goto-etc because it runs faster!)