Commit Graph

21 Commits

Author SHA1 Message Date
Mihai Bazon
ec7f895b54 log filename in parse errors / compressor warnings 2012-09-21 14:44:25 +03:00
Mihai Bazon
5491e1d7b1 better support for multiple input files:
- use a single AST_Toplevel node for all files
- keep original source filename in the tokens
2012-09-21 14:19:05 +03:00
Mihai Bazon
3da0ac4897 support for directives 2012-09-18 13:21:09 +03:00
Mihai Bazon
924aa58060 more optimizations that v1 does and some cleanups
- a = a + x ==> a+=x
- joining consecutive var statements (hoisting is not always desirable)
- x == false ==> x == 0, x != true ==> x != 1
- x, x ==> x; x = exp(), x ==> x = exp()
- discarding useless break-s
2012-09-14 15:36:38 +03:00
Mihai Bazon
8633b0073f cleaned up usage of AST_BlockStatement
The following nodes were instances of AST_BlockStatement: AST_Scope,
AST_SwitchBlock, AST_SwitchBranch.  Also, AST_Try, AST_Catch, AST_Finally
were having a body instanceof AST_BlockStatement.

Overloading the meaning of AST_BlockStatement this way turned out to be a
mess; we now have an AST_Block class that is the base class for things
having a block of statements (might or might not be bracketed).  The
`this.body` of AST_Scope, AST_Try, AST_Catch, AST_Finally is now an array of
statements (as they inherit from AST_Block).

Avoiding calling superclass's _walk function in walkers (turns out we walked
a node multiple times).
2012-09-05 11:39:43 +03:00
Mihai Bazon
6d0db4ce14 an AST_If is too a StatementWithBody 2012-09-03 12:11:44 +03:00
Mihai Bazon
d7c1dc6c05 a LabeledStatement should be in fact a StatementWithBody
This fixes output for:

    if (foo) {
        moo: if (bar) {
            break moo;
        }
    } else {
        baz();
    }

(the labeled statement must be outputted inside brackets)
2012-09-03 12:05:10 +03:00
Mihai Bazon
1bf5928b54 Reverting "minor perf. improvements"
Revert "minor perf. improvements"

This reverts commit 24bfd55a22.

broke the parser somehow; too early to optimize, let's get the other stuff running.
2012-09-03 10:26:23 +03:00
Mihai Bazon
24bfd55a22 minor perf. improvements 2012-09-02 11:11:39 +03:00
Mihai Bazon
58a3b5e93f update (c) years 2012-08-27 11:01:41 +03:00
Mihai Bazon
95b18e54a4 added license 2012-08-22 21:28:59 +03:00
Mihai Bazon
1b839eb35b hint that brackets may be required in AST_BlockStatement 2012-08-21 19:16:05 +03:00
Mihai Bazon
ffe58a9961 cleaned up some mess and started the actual compressor 2012-08-21 16:14:43 +03:00
Mihai Bazon
6c35135ace simple visitor API and code to figure out scope and references 2012-08-19 15:57:50 +03:00
Mihai Bazon
13f7b119bb code generator finally seems to work properly 2012-08-17 15:59:42 +03:00
Mihai Bazon
c7c163b82e lots'o'fixes in the output routines; still a looong way to go. 2012-08-16 21:36:16 +03:00
Mihai Bazon
7f273c3b89 codegen and dropped the useless walker 2012-08-16 18:11:04 +03:00
Mihai Bazon
c0ba9e2986 WIP 2012-08-15 14:50:27 +03:00
Mihai Bazon
861e26a666 WIP 2012-06-03 23:10:31 +03:00
Mihai Bazon
46e7507b44 Fixes some gotchas.
DynarchLIB (660K) now passes parsing in 440ms (about 30% slower than the
parser in UglifyJS v1).
2012-05-27 14:36:44 +03:00
Mihai Bazon
562b12f021 init repo 2012-05-27 14:13:26 +03:00