SquidDev / illuaminate

Very WIP static analysis for Lua
https://squiddev.cc/illuaminate/
BSD 3-Clause "New" or "Revised" License
49 stars 2 forks source link

Warn on accessing undefined globals/names #7

Open SquidDev opened 4 years ago

SquidDev commented 4 years ago

Now that #6 is merged, we have a decent way of determining what globals and modules are available in the current context. This should allow us to monitor global and require usages, and ensure they are consistent with what one might expect.

I'm probably envisaging two warnings here, though they can probably be done with the same linter:

However, it's not clear how to handle external names. We can definitely bake the standard library into illuaminate, but it might be nice to find a better way.

SquidDev commented 4 years ago

I've done some further work in b092e0e5a2605d8431bedf7dbba5c630ed4d0c19 and 8cc50003af3cdc420730ea1ecc4173437f93cbf1. However, the two systems really need to be merged and allow defining arbitrarily complex globals.

Currently we don't warn that string.subs is invalid, as string is simply registered as a global, rather than anything more complex.