gfwilliams / EspruinoCompiler

Node.js-based JavaScript->C++ compiler
25 stars 3 forks source link

Make sure .length result is treated as an int #7

Open gfwilliams opened 9 years ago

gfwilliams commented 9 years ago

Currently a simple FOR loop can fall off the fast path:

var l = "Hello".length;
for (var i=0;i<l;i++) ;

Will generate code that does 'l' (and hence the comparison) with JsVars instead of ints