Mihai Bazon
27142df4f5
minor: exp["10"] => exp[10]
2014-01-07 12:48:21 +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
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
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
d2190c2bf3
Properly scope catch identifier when --screw-ie8
...
Fix #344
2013-11-28 16:43:30 +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
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
Richard van Velzen
785c6064cc
Disallow reversal where lhs has higher or equal precedence
...
Fixes #267
2013-10-29 21:37:36 +01: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
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
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
Mihai Bazon
88fb83aa81
minor optimization
...
unlikely to help in hand-written code:
(something() ? foo : bar) == foo ==> something()
2013-10-02 15:31:31 +03:00
Mihai Bazon
95b4507c02
Fix error in the output minifying Function("return this")()
2013-09-30 11:49:29 +03:00
Mihai Bazon
afdaeba37d
More attempts to determine when addition is associative
...
Somebody hit me with bug reports on this. :)
Refs #300
2013-09-22 15:26:10 +03:00
Mihai Bazon
037199bfe2
Actually let's move away those monsters from the evaluate function
...
ev() should do a single thing — evaluate constant expressions. if that's
not possible, just return the original node. it's not the best place for
partial evaluation there, instead doing it in the compress functions.
2013-09-22 15:00:42 +03:00
Mihai Bazon
583fac0a0f
More dirty handling of [ ... ].join() in unsafe mode
...
Close #300
2013-09-22 13:14:42 +03:00
Dan Wolff
e8158279ff
Evaluate [...].join() if possible: minor bugfix
...
Follow-up to 78e98d2 .
2013-09-22 11:34:30 +03:00
Mihai Bazon
78e98d2611
When unsafe is set, evaluate [...].join() if possible
...
Close #298
2013-09-19 18:20:45 +03:00
Dan Wolff
8d14efe818
Concatenate strings also on the right-hand side of an expression that cannot be evaluated. Fix #126
...
E.g. converts:
a+'Hello'+'World'
to
a+'HelloWorld'
2013-09-19 13:03:03 +03:00
Mihai Bazon
85b527ba3d
Disallow continue referring to a non-IterationStatement. Fix #287
...
Simplifies handling of labels (their definition/references can be easily
figured out at parse time, no need to do it in `figure_out_scope`).
2013-09-02 19:36:16 +03:00
Mihai Bazon
ed80b4a534
Move support for negate_iife in the compressor, rather than code generator
...
(the code generator doesn't maintain enough context to know whether
the return value is important or discarded)
Fixes #272
2013-08-20 17:45:52 +03:00
Michael Ficarra
d9ad3c7cbf
fixes #259 : don't unnecessarily quote object properties when --screw-ie8
2013-08-18 19:45:06 -05:00
Mihai Bazon
4c4dc2137c
Don't drop unused setter argument.
...
Fix #257
2013-08-07 12:04:58 +03:00
Mihai Bazon
964d5b9aa4
Don't pretend to evaluate lambdas
...
Fix #255
2013-08-04 21:44:17 +03:00
Mihai Bazon
41c627379c
Reverting "added option for dropping unused params"
...
Revert "added option for dropping unused params"
(turns out we already had the `unused` option for this.)
This reverts commit e54df2226f .
2013-07-25 18:08:36 +03:00
Dusan Bartos
e54df2226f
added option for dropping unused params
2013-07-25 17:37:47 +03:00
Mihai Bazon
02a84385a0
Don't swap binary ops when "use asm" is in effect.
...
Refs #167
2013-06-07 12:52:09 +03:00
Mihai Bazon
caa8896a8a
Only compress code in new Function if all arguments are strings.
2013-05-14 18:36:31 +03:00
Mihai Bazon
f64539fb76
Compress code passed to new Function if it's a constant.
...
Only for `--unsafe`.
Close #203
2013-05-14 10:47:06 +03:00
Mihai Bazon
d56ebd7d7b
Fix a["1_1"]
...
Close #204
2013-05-14 10:42:34 +03:00
Mihai Bazon
a6ed2c84ac
Better fix for equality of typeof ... against "undefined"
2013-05-08 16:22:48 +03:00
Justin Lau
a1958aad56
Fixed typeof undefined optimization and updated related test case to
...
accomodates the sort behaviour changes made in commit
mishoo/UglifyJS2@aebafad41e .
Signed-off-by: Justin Lau <justin@tclau.com >
2013-05-08 16:22:48 +03:00
Justin Lau
9af2bbffde
Fixed dot properties not optimizing unicode identifiers. Signed-off-by: Justin Lau <justin@tclau.com>
2013-05-07 14:20:19 +03:00
Justin Lau
1e3bc0caa0
Fixed dot property issue with invlid identifier names.
...
Signed-off-by: Justin Lau <justin@tclau.com >
2013-05-05 22:27:43 +08:00
Michael Ficarra
5af144522a
fixes #189 : use dotted member access when --screw-ie8 option given
2013-04-20 15:11:05 -05:00
Roman Bataev
4b818056cf
Fix typeof evaluation for regex and function
2013-04-03 22:34:38 -04:00
Mihai Bazon
e4b078cff7
Disable unsafe by default
...
Close #147
2013-03-11 00:04:31 +02:00
Mihai Bazon
aebafad41e
Fix reordering comparisons
...
Close #143
2013-03-04 10:06:01 +02:00
Mihai Bazon
dac6efb43d
Drop last default: if it's the last branch and empty
...
Close #141
2013-03-01 13:12:03 +02:00
Mihai Bazon
8880f4824c
Compress boolean constants after evaluation
...
Close #137
2013-03-01 10:26:06 +02:00