Improve error message for missing opcode

This commit is contained in:
Jordan Eldredge 2019-09-11 20:36:46 -07:00
parent 999b7d6fa1
commit cb4ab12128

View file

@ -12,8 +12,12 @@ const PRIMITIVE_TYPES = {
// TODO: Don't depend upon COMMANDS
function opcodeToArgType(opcode) {
const argType = COMMANDS[opcode].arg;
switch (argType) {
const command = COMMANDS[opcode];
if (command == null) {
throw new Error(`Unknown opcode ${opcode}`);
}
switch (command.arg) {
case "func":
case "line":
return "COMMAND_OFFSET";