Mihai Bazon
582cc55cff
Display number of failed tests and corresponding files
2013-10-27 10:02:44 +02:00
Mark Jaquith
9cd118ca3d
Add a unit test for issue-126
...
Add a unit test to test to test for aggressive parenthesis removal that causes functional changes.
2013-10-25 16:28:15 -04: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
118105db43
Add an exit code to the test suite
...
By adding the exit code 1 (or any other non-zero exit code) `npm test`
will know the tests didn't perform correctly. This way it's easier to
know if pull requests are good or bad.
2013-10-23 20:24:58 +02: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
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
Mihai Bazon
4c4dc2137c
Don't drop unused setter argument.
...
Fix #257
2013-08-07 12:04:58 +03:00
David Glasser
b1febde3e9
Fix output for arrays whose last element is a hole: [1,,]
...
1529ab96 started to do this (by considering holes to be separate from
"undefined") but it still converted
[1,,] (length 2, last element hole, trailing comma)
to
[1,] (length 1, trailing comma)
Unfortunately the test suite doesn't really make this clear: the new test here
passes with or without this patch because run-tests.js beautifys the expected
output (in "make_code"), which does the incorrect transformation! If you make
some manual change to arrays.js to make the test fail and see the INPUT and
OUTPUT, then you can see that without this fix, [1,,] -> [1,], and with this fix
it stays [1,,].
2013-07-18 15:39:22 +03:00
Mihai Bazon
d56ebd7d7b
Fix a["1_1"]
...
Close #204
2013-05-14 10:42:34 +03:00
Trey Griffith
1e9f98aa51
add a test for zero-length string in is_identifier_string, which is used in property compression. Also added a test exercising the change.
2013-05-08 22:43:20 +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
672699613e
Added test cases for #104 .
...
Signed-off-by: Justin Lau <justin@tclau.com >
2013-05-08 16:22:48 +03:00
Justin Lau
fcd544cc10
Added test scenario with unicode in properties name.
...
Signed-off-by: Justin Lau <justin@tclau.com >
2013-05-06 01:26:33 +08:00
Justin Lau
8227e8795b
Added scenario in test case where properties shouldn't be accessed with
...
dotted syntax even with screw_ie8 option.
Signed-off-by: Justin Lau <justin@tclau.com >
2013-05-05 22:08:13 +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
b956e5f1d9
Add tests for typeof evaluation
2013-04-03 22:34:19 -04: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
Richard Gibson
522566ea80
Fix #105 : property comparison to undefined is not always safe
2013-01-23 23:52:04 -05:00
David Glasser
1529ab965a
Fix output for arrays containing undefined values.
...
1b6bcca7 was a first attempt at this. That commit made Uglify stop replacing
holes with undefined, but instead it started replacing undefined with
holes. This is slightly problematic, because there is a difference between a
hole and an undefined value. More problematically, it changed [1,undefined] to
[1,] which generally doesn't even parse as a hole (just as a trailing comma), so
it didn't even preserve the length of the array!
Instead, parse holes as their own special AST node which prints invisibly.
2013-01-17 11:36:10 +02:00
Mihai Bazon
b5c3253b49
Add test for issue #59
2012-11-30 11:26:37 +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
53355bdb24
fix invalid AST produced by dropping unused variable
...
close #44
2012-11-12 13:23:57 +02:00
Mihai Bazon
1a5fd3e052
optimization for if/break as first statement in a loop body
...
for(...; x; ...) if (y) break; → for(...; x&&!y; ...);
similarly for `while` and some combinations (i.e. the `break` appears in the
`else` clause, etc.)
2012-11-08 11:43:14 +02:00
Mihai Bazon
abe0ebbf02
don't move expressions containing the binary in operator into the for initializer
...
(opera can't parse it)
close #25
2012-10-30 14:50:47 +02:00
Mihai Bazon
70fd2b1f33
fix for if (...) return; else return ...;
...
(it was assumed that the first `return` always contains a value)
close #22
2012-10-24 09:33:32 +03:00
Mihai Bazon
30faaf13ed
more sequence optimizations (lift some sequences above binary/unary expressions so that we can avoid parens)
2012-10-22 11:58:06 +03:00
Mihai Bazon
afb7faa6fa
more optimizations for some break/continue cases
2012-10-18 15:14:57 +03:00
Mihai Bazon
1ffd526554
disable warnings in the test suite
2012-10-13 15:18:11 +03:00
Mihai Bazon
fcc0229087
drop unused function arguments
...
also add test for "drop_unused" (the last one fails for now)
2012-10-13 15:04:44 +03:00
Mihai Bazon
ba3df646c0
actually enable the option that drops unused names in the test of issue #12
2012-10-12 11:41:48 +03:00
Mihai Bazon
731fa9c236
add test for issue #12
2012-10-12 10:49:48 +03:00
Mihai Bazon
3412498795
AST cleanup (dropped AST_StatementBase)
2012-10-03 15:41:11 +03:00
Mihai Bazon
c11de17e99
added option for side-effect-free statements, fix test
2012-10-03 13:08:03 +03:00
Mihai Bazon
378ed17809
disable hoist_vars by default and change comparations to comparisons
2012-10-03 11:27:05 +03:00
Mihai Bazon
13278c6649
removed the "squeeze" method (it's now effectively "transform")
2012-09-26 19:52:32 +03:00
Mihai Bazon
4f97da9660
minor tests fix
2012-09-24 10:27:49 +03:00
Mihai Bazon
6ad414ef28
minor
2012-09-17 14:33:36 +03:00
Mihai Bazon
45a3970ca3
one more test for sequences
2012-09-17 12:53:52 +03:00
Mihai Bazon
7b6a402916
rewrite handle_if_return
...
optimizations of if/return/continue seem to be even better now
2012-09-16 15:46:20 +03:00
Mihai Bazon
d72c1d1293
few more optimizations:
...
- do multiple passes in tighten_body if it was changed
- transform if (foo) return x; return y; ==> return foo?x:y
- don't optimize !0 as true (use best_of after evaluation of constant expr)
With hoist_vars off we now beat UglifyJS v1 on jQuery-1.8.1
2012-09-13 15:20:57 +03:00
Mihai Bazon
f5027ec1fc
minor
2012-09-12 16:29:20 +03:00
Mihai Bazon
2b4093ba83
fixed run-tests and an issue about reversing the condition in AST_If
2012-09-12 13:00:13 +03:00
Mihai Bazon
a41e6cfabb
more progress on the compressor (WIP)
2012-09-10 16:37:05 +03:00