jsx/JSX — pull request #265 by wasabiz (2013-09-10 12:15:05+00:00)
Title: add lambda lifting optimize command

Sorry but this is WORK-IN-PROGRESS, I want some comments or reviews on this implementation strategy.

sample code:
```
class _Main {
static function main (args : string[]) : void {
function square (n : number) : number {
return n * n;
}
log square(2);
}
}
```
`$ bin/jsx --optimize lambda-lifting foo.jsx`
```
$__jsx_extend([_Main], Object);
function _Main$main$AS(args) {
console.log(_Main$square$N(2));
};

_Main.main = _Main$main$AS;
_Main.main$AS = _Main$main$AS;

function _Main$square$N(n) {
return n * n;
};

_Main.square$N = _Main$square$N;
```

As of now the command optimizes first-level (not nested) closures in method by lifting them up to the method level. This is the same strategy as "staticize" optimize command (actually I borrowed a plenty of code from that).

My future plans are
1. Optimize nested inner function statements as well.
2. If they contain "this" inside themselves, do lift them up to the block level (the top statement block in the method) instead of staticize.
3. finally do it against function expressions, too.