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
Mihai Bazon
3a591c43fe
Fix compressing do {...} while (false)
...
It's not safe to transform it to {...} because the body might contain
`break`. The solution could be more elaborate (detect if body contains
`break`) but I don't think it's worth the trouble.
Close #129
2013-02-19 18:12:19 +02:00
Mihai Bazon
f36e4e9a78
Give up evaluating (unary-prefix '-' 0)
...
Close #117
------
JS, WHY YOU SUCK SO BADLY? ;-(
2013-02-06 11:51:09 +02:00
Mihai Bazon
9e8ba27dcd
Fix handling of constants
...
Close #113
2013-02-06 11:15:31 +02:00
Richard Gibson
522566ea80
Fix #105 : property comparison to undefined is not always safe
2013-01-23 23:52:04 -05:00
Mihai Bazon
f0909bdc8f
Handle String() with no arguments.
...
Fix #91
2013-01-17 11:01:38 +02:00
Mihai Bazon
31c4a37e37
Optimize new Array(1, 2, 3) → [1, 2, 3]
...
Close #74
2012-12-21 21:04:35 +02:00
Mihai Bazon
16430acc1f
small improvement on merging assignments into hoisted vars
2012-12-05 13:14:49 +02:00
Mihai Bazon
320c110b33
When hoisting variables, try to merge in assignments that follow.
2012-12-05 12:30:25 +02:00
Mihai Bazon
5cc90db7d0
Don't messup compressor stack while optimizing Switch
...
Fix #59
2012-11-30 11:16:09 +02:00
Mihai Bazon
4f555e2232
fix for https://github.com/mishoo/UglifyJS/issues/474
2012-11-23 10:20:00 +02:00
Mihai Bazon
0d3fd2ef30
retain (1,eval) as is when it's the expression of an AST_Call
...
otherwise we change the meaning of eval from global to lexical.
2012-11-17 12:05:31 +02:00
Mihai Bazon
bdfcbf496b
better solution for the last test in constant switch folding
2012-11-14 12:21:43 +02:00
Mihai Bazon
dba8da4800
optimize constant switch blocks
...
ref. mishoo/UglifyJS#441
2012-11-14 12:06:07 +02:00
Mihai Bazon
60c0f40250
Merge branch 'optimize_concat' of https://github.com/rvanvelzen/UglifyJS2 into rvanvelzen-optimize_concat
2012-11-13 14:38:55 +02:00
Mihai Bazon
e02771a5f2
don't change order in binary expressions if both operands have side effects
2012-11-13 14:32:07 +02:00