Commit Graph

1447 Commits

Author SHA1 Message Date
Mihai Bazon 1d0127de21 Fix end token for conditionals. Close #404 2014-01-21 10:38:59 +02:00
Ville Lautanala 1e31011874 Don't unescape byte order marks in regexps 2014-01-19 12:27:03 +02:00
Mihai Bazon 4339bd5cfa Don't unescape \x2f (slash) in regexps. #54 2014-01-18 12:31:50 +02:00
Mihai Bazon 90a330da16 simplify 2014-01-10 10:36:15 +02:00
Mihai Bazon cad1f9cbd1 Unescape Unicode sequences in regexps when ascii_only is false. #54 2014-01-10 10:33:58 +02:00
Mihai Bazon c3087dd179 Better process_for_angular before other statement reductions. #395 2014-01-08 11:39:24 +02:00
Mihai Bazon 2c305af478 Support @ngInject with angular compressor option. Close #395. 2014-01-08 11:28:32 +02:00
Mihai Bazon 2c88eb6fbe doh. 2014-01-07 12:54:14 +02:00
Mihai Bazon 27142df4f5 minor: exp["10"] => exp[10] 2014-01-07 12:48:21 +02:00
Mihai Bazon 5e4c7f4245 Fix parens for property access -- (foo, bar)["baz"] 2014-01-05 11:48:01 +02:00
Mihai Bazon b521b4b926 Conditional/call optimization
foo ? bar(x) : bar(y)  ==>  bar(foo ? x : y)
2013-12-29 10:31:30 +02:00
Mihai Bazon aa9de76370 Mark yield as reserved word. Close #375. 2013-12-22 20:52:19 +02:00
Mihai Bazon 5a083a938d Optimize seq,void 0. Close #377.
(x, void 0)    => void x
    (x, undefined) => void x
2013-12-22 11:36:45 +02:00
Mihai Bazon 7a30d826b8 Better fix for comments in AST_Exit
Close #374
2013-12-18 15:54:12 +02:00
Mihai Bazon be55a09edf Take out all comments from an AST_Exit's value
Fix #372
2013-12-18 13:30:26 +02:00
Mihai Bazon 428e19fed2 Add option to adjust the src/target line in the source map 2013-12-18 12:10:02 +02:00
Mihai Bazon f65e55dff4 minor 2013-12-16 20:37:09 +02:00
colorhook fa3300f314 bugfix #242 2013-12-16 15:53:43 +08:00
Mihai Bazon bd0886a2c0 semicolons 2013-12-10 20:24:27 +02:00
Mihai Bazon 248f304f02 Merge pull request #245 from ForbesLindesay/patch-1
Make `DefaultsError` a real `Error` object
2013-12-10 10:23:29 -08:00
Mihai Bazon dc5f70eab5 Add drop_console option to the compressor 2013-12-10 19:44:41 +02:00
Mihai Bazon df8c5623af minor 2013-12-10 19:39:03 +02:00
Mihai Bazon 8f35a363d9 AST_Catch shouldn't really inherit from AST_Scope. Fix #363
I hereby acknowledge that figure_out_scope has become a mess.
2013-12-05 13:30:29 +02:00
Mihai Bazon d2190c2bf3 Properly scope catch identifier when --screw-ie8
Fix #344
2013-11-28 16:43:30 +02:00
Mihai Bazon c16d538ce7 Add --noerr to turn off argument name checking
for now only used for keys passed to `-c` or `-b`.
2013-11-28 13:15:01 +02:00
Mihai Bazon 50b8d7272c Fix faulty compression
`String(x + 5)` is not always the same as `x + "5"`.  Overlooked that. :-(

Close #350
2013-11-20 21:13:16 +02:00
Mihai Bazon 7d11b96f48 Only descend twice after drop_unused if it's the same node type.
Fix #345
2013-11-08 11:57:17 +02:00
Mihai Bazon eab99a1c3d Better fix for #343
We can in fact lift sequences, but only if the operation is assignment and
the left-hand side has no side effects nor property access -- that should
guarantee that whatever we place before it cannot affect the sense of the
assignment.

Dropped contrived test case (too hard to support it now), added a more
meaningful one.
2013-11-06 10:48:48 +02:00
Mihai Bazon f4919e3a25 Do not lift sequence from right-hand side of binary operation. Fix #343 2013-11-06 10:18:28 +02:00
Mihai Bazon 63287c0e68 Workaround for Safari bug
Close #313
2013-10-30 13:59:59 +02:00
Mihai Bazon c5ed2292bf Fix parsing setters/getters (allow keywords for name).
The "key" property was always "set" or "get", which didn't make much sense.
Now it'll be the actual name of the setter/getter (AST_Node), and the
AST_Accessor object itself, which represents the function, won't store any
name.

Close #319
2013-10-30 11:50:22 +02:00
Mihai Bazon b70670b69f Fix regression after e4c5302406
`x * (y * z)` ==> `x * y * z` -- the better place to do this is in the
compressor rather than codegen.
2013-10-30 10:45:58 +02:00
Mihai Bazon 9dd97605bc indentation 2013-10-30 10:44:50 +02:00
Mihai Bazon e4c5302406 Fix output for x = 2 * (a % b / b * c)
(issue #337)
2013-10-30 09:11:55 +02:00
Mihai Bazon bea3d90771 minor 2013-10-30 09:10:56 +02:00
Richard van Velzen 785c6064cc Disallow reversal where lhs has higher or equal precedence
Fixes #267
2013-10-29 21:37:36 +01:00
Mihai Bazon b214d3786f Fix typo 2013-10-29 15:53:54 +02:00
Mihai Bazon a14c6b6574 Avoid shadowing name of function expression with function argument
Close #179, #326, #327
2013-10-29 13:18:09 +02:00
Mihai Bazon f1b7094a57 Add "preamble" output option
Close #335
2013-10-29 11:09:18 +02:00
Mihai Bazon 0358e376f0 Fix codegen for when comments_before is undefined.
Fix #333
2013-10-28 09:39:29 +02:00
Richard van Velzen e2daee9a65 Fix RHS concat (raised in #330)
When attempting to concat the left-side of the rhs, make sure the rhs is
a string.
2013-10-26 18:44:52 +02:00
Richard van Velzen 1a5a4bd631 Fix #269
Shorten most primitives where possible. Also optimize some edge cases.
2013-10-24 11:08:33 +02:00
Richard van Velzen 7055af8221 Fix #280
The `init` of the `ForStatement` is not a `BlockStatement` before it was
descended. The descend has to happen first, and *then* the actual
checks.
2013-10-23 22:26:04 +02:00
Mihai Bazon 63d04fff69 Revert #3a81f60 for now
(with it some tests break and it can generate invalid output, see issue #44)
2013-10-22 21:50:55 +03:00
Mihai Bazon d09f0adae3 arguments outside of a function is an ordinary variable.
Fix #501
2013-10-17 18:20:33 +03:00
Mihai Bazon 3fa9265ce4 wrap up 2013-10-09 22:15:43 +03:00
Mihai Bazon 3a81f60982 Don't drop_unused before compression.
Fix #280, #282
2013-10-09 19:15:09 +03:00
Mihai Bazon f2348dd98b Rename clean_getters to pure_getters; add pure_funcs. 2013-10-04 13:17:25 +03:00
David Glasser bb0a762d12 Only allow identifier start characters at the beginning of identifiers.
Without this fix, the following source:

   x = {"\u200c": 42};

would incorrectly be converted into a quoteless key. But while \u200c is allowed
to be in identifiers, it cannot be at the beginning, as per ES5.

(For example, the SockJS client library doesn't work under uglify starting with
d9ad3c7c.)
2013-10-03 17:02:19 -07:00
Mihai Bazon 8cc86fee60 add clean_getters compressor option (default false)
allows one to specify if `foo.bar` is considered to have side effects.
2013-10-02 19:38:01 +03:00