jsx / JSX

JSX - a faster, safer, easier JavaScript
http://jsx.github.io/
MIT License
1.46k stars 102 forks source link

--optimize inline may access global variables #325

Closed kazuho closed 10 years ago

kazuho commented 10 years ago

If --optimize inline is set, the _Main.main function of t/run/356.expand-lhs-value.jsx gets compiled into the code below, which accesses an undeclared global n.

function _Main$main$AS(args) {
    n = 1;
};
kazuho commented 10 years ago

@wasabiz do you have any idea? The test case seem to address some kind of problem within the inlining optimizer but I could not find changes to the compiler source that corresponds to the test.

nyuichi commented 10 years ago

@kazuho No, I don't. In fact I've never even touched around the inliner at all. Presumably, jsx's inliner is presently almost broken because nobody takes care of and maintained it, we'd better do a bunch of refactoring against it now.

kazuho commented 10 years ago

Fixed in commit 380b864.

Well, Inline optimizer is used in many of the projects including the JSX compiler itself (the npm-packaged version of JSX is optimized using --release and thus is using the inline optimizer), and I do care of it.