Open natevw opened 10 years ago
This code (used by https://github.com/tessel/cloud-client/tree/es-temp) is unable to run on Tessel firmware:
// Generated by CoffeeScript 1.7.1 var item, name, _fn, _ref; module.exports = { CRC1: require('./crc1').CRC1, CRC8: require('./crc8').CRC8, CRC81Wire: require('./crc8_1wire').CRC81Wire, CRC16: require('./crc16').CRC16, CRC16CCITT: require('./crc16_ccitt').CRC16CCITT, CRC16Modbus: require('./crc16_modbus').CRC16Modbus, CRC24: require('./crc24').CRC24, CRC32: require('./crc32').CRC32 }; _ref = module.exports; _fn = function(item) { return module.exports[name.toLowerCase()] = function(value) { return new item().hexdigest(value); }; }; for (name in _ref) { item = _ref[name]; _fn(item); }
postel:cloud-client natevw$ tessel run index.js TESSEL! Connected to TM-00-02-f0009a30-005d4757-6c8045c2. Bundling directory /Users/natevw/Desktop/Clients/Technical_Machine/cloud-client (~3.04 MB) Deploying bundle (4.20 MB)... Running script... /app/node_modules/crc/lib/index.js:18: attempt to index upvalue 'name' (a nil value)
Here's what colony-compiler node_modules/crc/lib/index.js shows, is the for loop variable shadowing the intended local?
colony-compiler node_modules/crc/lib/index.js
return function (_ENV, _module) local exports, module = _module.exports, _module; local item, name, __fn, __ref = item, name, __fn, __ref; --[[35]] item = nil; name = nil; __fn = nil; __ref = nil; --[[63]] module.exports = _obj({ ["CRC1"]=require(_global, ("./crc1")).CRC1, ["CRC8"]=require(_global, ("./crc8")).CRC8, ["CRC81Wire"]=require(_global, ("./crc8_1wire")).CRC81Wire, ["CRC16"]=require(_global, ("./crc16")).CRC16, ["CRC16CCITT"]=require(_global, ("./crc16_ccitt")).CRC16CCITT, ["CRC16Modbus"]=require(_global, ("./crc16_modbus")).CRC16Modbus, ["CRC24"]=require(_global, ("./crc24")).CRC24, ["CRC32"]=require(_global, ("./crc32")).CRC32 }); --[[407]] __ref = module.exports; --[[430]] __fn = (function (this, item) --[[455]] if true then return (function () local _r = (function (this, value) --[[521]] if true then return _new(item):hexdigest(value); end end); module.exports[name:toLowerCase()] = _r; return _r; end)(); end end); --[[565]] for name in _pairs(__ref) do name = ""+name; --[[588]] item = __ref[name]; --[[609]] __fn(_global, item); end; return _module.exports; end
The for loop is shadowing. https://github.com/tessel/runtime/issues/404 I should fix that.
This code (used by https://github.com/tessel/cloud-client/tree/es-temp) is unable to run on Tessel firmware:
Here's what
colony-compiler node_modules/crc/lib/index.js
shows, is the for loop variable shadowing the intended local?