asm-js / validator

A reference validator for asm.js.
Apache License 2.0
1.78k stars 154 forks source link

Allow constants in case blocks #107

Open kg opened 9 years ago

kg commented 9 years ago

Presently the spec requires case blocks to switch on integer literals. It would be quite nice if they could switch on named integer constants instead, i.e.:

const OP_A = 1, OP_B = 2, OP_C = 3;
switch (opcode) {
  case OP_A:
    ...

This would improve human-friendliness for reading & debugging.

Related to this it's unclear whether the spec allows constants (see #77).