Commit Graph

40 Commits

Author SHA1 Message Date
Mihai Bazon
52bcca288f started support for generating source maps (WIP)
plugged in @fitzgen's source-map library
2012-08-29 19:39:19 +03:00
Mihai Bazon
48440dc250 don't mangle names of setters/getters 2012-08-29 19:26:48 +03:00
Mihai Bazon
6569e66bf8 update with link to discussion about Esprima vs. UglifyJS speed 2012-08-29 11:18:05 +03:00
Mihai Bazon
86cff2029f docstring for AST_StatementWithBody 2012-08-28 15:39:53 +03:00
Mihai Bazon
1b6bcca717 fix output for arrays containing undefined values
[1,,2,] ==> [1,,2] instead of [1,undefined,2]
2012-08-28 15:38:35 +03:00
Mihai Bazon
7fcb6bcb12 fix code generator for this case:
if (foo) {
  with (bar)
    if (baz)
      x();
} else y();

(the compressor removes the brackets since the consequent consists of a
single statement, but the codegen must include the brackets because
otherwise the `else` would refer to the inner `if`)
2012-08-28 15:29:58 +03:00
Mihai Bazon
ce8e8d57c0 added README 2012-08-27 12:29:53 +03:00
Mihai Bazon
bf70205b15 minor 2012-08-27 11:48:07 +03:00
Mihai Bazon
58a3b5e93f update (c) years 2012-08-27 11:01:41 +03:00
Mihai Bazon
8dfa9fe7e5 minor 2012-08-27 11:00:26 +03:00
Mihai Bazon
4437e7af19 fix compressing a,b; return c; into return a,b,c; 2012-08-27 11:00:22 +03:00
Mihai Bazon
a8e49f1536 added print_to_string helper method 2012-08-27 10:59:33 +03:00
Mihai Bazon
8d233c38d4 fix current_col and force a newline every 32K (support options.max_line_len) 2012-08-23 10:39:33 +03:00
Mihai Bazon
95b18e54a4 added license 2012-08-22 21:28:59 +03:00
Mihai Bazon
159a6f048c wrote more of the compressor and added some tests 2012-08-22 15:21:58 +03:00
Mihai Bazon
f53e139d3c fix output for certain edge cases
the statements if, for, do, while and with might have an AST_EmptyStatement
as body; if that's the case, we need to make sure that the semicolon gets in
the output.
2012-08-22 13:20:05 +03:00
Mihai Bazon
fb8c9e3a48 declare some properties in the node constructor so that they're copied in clone 2012-08-22 00:01:55 +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
7ae1c600a2 some reorganization
(moved pretty much everything that relates to scope in scope.js, added a
module for NodeJS that can be used with require() and exports everything.)
2012-08-21 13:53:16 +03:00
Mihai Bazon
92bd53b513 handle labels properly
(they can't be handled the same way as variables in a scope)
2012-08-21 12:45:06 +03:00
Mihai Bazon
159333f4c5 warn about unreferenced symbols 2012-08-21 12:07:34 +03:00
Mihai Bazon
99456c6156 more fixes:
- added walker for AST_ObjectProperty
- handle redefinitions properly (only mangle one symbol, make them all point
  to a single definition)

DynarchLIB seems to run fine after mangling + compressed output.
2012-08-21 11:38:49 +03:00
Mihai Bazon
458e251d7e added mangler and other stuff 2012-08-20 17:32:35 +03:00
Mihai Bazon
1fe0ff9fff doc (WIP) 2012-08-20 00:35:54 +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
4488758d48 some fixes (need testing) in AST_If codegen 2012-08-18 12:29:57 +03:00
Mihai Bazon
cd8ae5f712 minor whitespace issues 2012-08-17 23:08:09 +03:00
Mihai Bazon
ef87c9fd8f big speed improvement (observable when beautify = false)
who would have thought that str.charAt(str.length - 1) is not a constant,
instant operation?  seems to get slower and slower as the string grows.

0.6s vs. 3s
2012-08-17 19:04:23 +03:00
Mihai Bazon
901f77047e don't output both space and semicolon when beautify=false 2012-08-17 18:33:26 +03:00
Mihai Bazon
07cbc8d3af added some comments about the rules governing parens 2012-08-17 18:06:29 +03:00
Mihai Bazon
4fb6021b0b fix one more glitch 2012-08-17 16:27:43 +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
22bb5e8306 added small node test script 2012-05-27 14:36:51 +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