Project: titanium
Issue TIMOB-7559: iOS: CommonJS require: undeclared variable referenced from module fails to generate error
Undeclared variables referenced from a module fail to generate an error. Android does generate the error. Screenshot attached. The undeclared variable can then be used in further logic, such as adding it to a window. Screenshot attached. If an undeclared variable is used in the module itself, there is an error. If an undeclared variable is returned from an exports function-call, there is an error. If an undeclared variable is defined as a return value in an exports function, but the function is never called, there is no error. If an undeclared variable is returned from an exports function-call and assigned to a new variable outside the module, there is no error, and the variable can continue to be used. Steps to Reproduce: 1. Run Code (also attached): {code:title=app.js} var undeclaredVar = require('Module').getUndeclaredVar(); Ti.UI.createWindow().add(undeclaredVar); {code} {code:title=Module.js} exports.getUndeclaredVar = function() {	return undeclaredVar; }; {code} Expected Result: Runtime error indicating undeclared variable. Actual Result: No runtime error.
Story points: 2