Browse Source

throw error if there is no string representation

patch-2
Ryan X. Charles 11 years ago
parent
commit
eaaf8aade3
  1. 5
      lib/opcode.js

5
lib/opcode.js

@ -33,7 +33,10 @@ Opcode.prototype.fromString = function(str) {
};
Opcode.prototype.toString = function() {
return Opcode.reverseMap[this.num];
var str = Opcode.reverseMap[this.num];
if (typeof str === 'undefined')
throw new Error('Opcode does not have a string representation');
return str;
};
Opcode.map = {

Loading…
Cancel
Save