Nathan Shively-Sanders 2a22528c81 Check for require when binding commonjs
Previously, the binder didn't check for a declared function named
'require' when binding require in JS. It unconditionally treated
'require' as the commonjs function, even when a local function named
'require' existed and even in ES modules. Now, the binder checks for a
local function named require and avoids binding in that case.

Both before and after, actually importing the module causes the checker
to issue an error saying that top-level functions named 'require' are
illegal. But this error doesn't show up until you've imported from the
module, so you won't notice it in the editor, where JS errors are most
useful.

Within-binder checks for declared functions are dependent on binding order, but
function binding simulates hoisting by binding all function declarations
first, so it should be pretty reliable.
2022-08-01 13:57:53 -07:00
..