Change how optional opcode tables are built

This commit is contained in:
Jeff Parsons 2015-03-26 16:56:37 -07:00 committed by jeffpar
commit e3a5408031
10 changed files with 145 additions and 104 deletions

View file

@ -1316,11 +1316,7 @@ Bus.prototype.addPortInputTable = function(component, table, offset)
{
if (offset === undefined) offset = 0;
for (var port in table) {
/*
* JavaScript coerces property keys to strings, so we use parseInt() to coerce them back to numbers.
*/
port = parseInt(port, 10);
this.addPortInputNotify(port + offset, port + offset, component, table[port]);
this.addPortInputNotify(+port + offset, +port + offset, component, table[port]);
}
};
@ -1440,11 +1436,7 @@ Bus.prototype.addPortOutputTable = function(component, table, offset)
{
if (offset === undefined) offset = 0;
for (var port in table) {
/*
* JavaScript converts property keys to strings (brilliant), so we use parseInt() to convert them back to numbers.
*/
port = parseInt(port, 10);
this.addPortOutputNotify(port + offset, port + offset, component, table[port]);
this.addPortOutputNotify(+port + offset, +port + offset, component, table[port]);
}
};