UglifyJS.git
6 years agoenhance `unsafe_proto` (#2733)
Alex Lam S.L [Fri, 5 Jan 2018 22:16:51 +0000 (06:16 +0800)]
enhance `unsafe_proto` (#2733)

6 years agoufuzz: add strings "a", "b", "c" to VALUES (#2732)
kzc [Fri, 5 Jan 2018 21:54:53 +0000 (16:54 -0500)]
ufuzz: add strings "a", "b", "c" to VALUES (#2732)

6 years agofix corner case with `arguments` as function name (#2729)
Alex Lam S.L [Fri, 5 Jan 2018 14:21:18 +0000 (22:21 +0800)]
fix corner case with `arguments` as function name (#2729)

fixes #2728

6 years agoimprove `if_return` (#2727)
Alex Lam S.L [Fri, 5 Jan 2018 12:24:30 +0000 (20:24 +0800)]
improve `if_return` (#2727)

6 years agowarn on deprecated features (#2726)
Alex Lam S.L [Fri, 5 Jan 2018 11:36:02 +0000 (19:36 +0800)]
warn on deprecated features (#2726)

- `function.arguments`
- `function.callers`

fixes #2719

6 years agofix `mangle` name collision across files (#2722)
Alex Lam S.L [Thu, 4 Jan 2018 21:08:09 +0000 (05:08 +0800)]
fix `mangle` name collision across files (#2722)

6 years agofix corner case in `inline` (#2720)
Alex Lam S.L [Thu, 4 Jan 2018 15:38:37 +0000 (23:38 +0800)]
fix corner case in `inline` (#2720)

6 years agoreminify tests upon `expect_stdout` (#2716)
Alex Lam S.L [Thu, 4 Jan 2018 12:13:05 +0000 (20:13 +0800)]
reminify tests upon `expect_stdout` (#2716)

6 years agoforbid block-scoped `AST_Defun` in strict mode (#2718)
Alex Lam S.L [Thu, 4 Jan 2018 10:45:51 +0000 (18:45 +0800)]
forbid block-scoped `AST_Defun` in strict mode (#2718)

6 years agopreserve constant modification under strict mode (#2717)
Alex Lam S.L [Thu, 4 Jan 2018 07:53:53 +0000 (15:53 +0800)]
preserve constant modification under strict mode (#2717)

6 years agoextend `inline` (#2714)
Alex Lam S.L [Thu, 4 Jan 2018 04:58:40 +0000 (12:58 +0800)]
extend `inline` (#2714)

- compress `function` with variables within loops
- restrict to `AST_Var` for better compatibility with ES6+

6 years agoapply `collapse_vars` to loop conditions (#2712)
Alex Lam S.L [Wed, 3 Jan 2018 19:18:28 +0000 (03:18 +0800)]
apply `collapse_vars` to loop conditions (#2712)

6 years agodrop `unused` assignment based on `reduce_vars` (#2709)
Alex Lam S.L [Wed, 3 Jan 2018 17:03:33 +0000 (01:03 +0800)]
drop `unused` assignment based on `reduce_vars` (#2709)

6 years agofix `reduce_vars` on `AST_Defun` (#2708)
Alex Lam S.L [Wed, 3 Jan 2018 09:18:38 +0000 (17:18 +0800)]
fix `reduce_vars` on `AST_Defun` (#2708)

6 years agoextend `__PURE__` to `AST_New` (#2706)
Alex Lam S.L [Tue, 2 Jan 2018 20:48:07 +0000 (04:48 +0800)]
extend `__PURE__` to `AST_New` (#2706)

fixes #2705

6 years agoinline functions with `AST_Var` (#2688)
Alex Lam S.L [Tue, 2 Jan 2018 17:54:44 +0000 (01:54 +0800)]
inline functions with `AST_Var` (#2688)

6 years agoenhance `collapse_vars` (#2704)
Alex Lam S.L [Tue, 2 Jan 2018 10:42:15 +0000 (18:42 +0800)]
enhance `collapse_vars` (#2704)

6 years agoenhance `if_return` (#2703)
Alex Lam S.L [Tue, 2 Jan 2018 07:09:51 +0000 (15:09 +0800)]
enhance `if_return` (#2703)

6 years agoreset argument value within loop after `inline` (#2699)
Alex Lam S.L [Mon, 1 Jan 2018 17:24:53 +0000 (01:24 +0800)]
reset argument value within loop after `inline` (#2699)

6 years agoscan within IIFEs of assigned values (#2702)
Alex Lam S.L [Mon, 1 Jan 2018 17:24:23 +0000 (01:24 +0800)]
scan within IIFEs of assigned values (#2702)

fixes #2701

6 years agoenhance `join_vars` & `sequences` (#2697)
Alex Lam S.L [Sun, 31 Dec 2017 16:09:26 +0000 (00:09 +0800)]
enhance `join_vars` & `sequences` (#2697)

- nudge declarations without assignments
  - within `AST_BlockStatement`
  - across `AST_If`

6 years agofix `inline` on duplicate argument names (#2698)
Alex Lam S.L [Sun, 31 Dec 2017 12:59:58 +0000 (20:59 +0800)]
fix `inline` on duplicate argument names (#2698)

6 years agoreduce hoisting declarations (#2687)
Alex Lam S.L [Sun, 31 Dec 2017 08:15:00 +0000 (16:15 +0800)]
reduce hoisting declarations (#2687)

6 years agov3.3.4
Alex Lam S.L [Sat, 30 Dec 2017 16:01:14 +0000 (00:01 +0800)]
v3.3.4

6 years agofix `dead_code` on escaped `return` assignment (#2693)
Alex Lam S.L [Sat, 30 Dec 2017 07:20:25 +0000 (15:20 +0800)]
fix `dead_code` on escaped `return` assignment (#2693)

fixes #2692

6 years agominor clean-ups (#2686)
Alex Lam S.L [Fri, 29 Dec 2017 06:04:52 +0000 (14:04 +0800)]
minor clean-ups (#2686)

6 years agov3.3.3
Alex Lam S.L [Thu, 28 Dec 2017 19:07:39 +0000 (03:07 +0800)]
v3.3.3

6 years agofix `pure_getters` on `AST_Binary` (#2681)
Alex Lam S.L [Thu, 28 Dec 2017 09:01:01 +0000 (17:01 +0800)]
fix `pure_getters` on `AST_Binary` (#2681)

fixes #2678

6 years agoimprove assignment variations (#2671)
Alex Lam S.L [Thu, 28 Dec 2017 07:36:55 +0000 (15:36 +0800)]
improve assignment variations (#2671)

6 years agofix function inlining within loops (#2675)
Alex Lam S.L [Wed, 27 Dec 2017 18:53:14 +0000 (02:53 +0800)]
fix function inlining within loops (#2675)

fixes #2663

6 years agofix `dead_code` on `return` assignments (#2668)
Alex Lam S.L [Tue, 26 Dec 2017 23:40:34 +0000 (07:40 +0800)]
fix `dead_code` on `return` assignments (#2668)

fixes #2666

6 years agoretain recursive function names (#2667)
Alex Lam S.L [Tue, 26 Dec 2017 23:00:12 +0000 (07:00 +0800)]
retain recursive function names (#2667)

fixes #2665

6 years agofix bugs on substituted `AST_Defun` (#2661)
Alex Lam S.L [Tue, 26 Dec 2017 21:31:37 +0000 (05:31 +0800)]
fix bugs on substituted `AST_Defun` (#2661)

fixes #2660

6 years agoreplace single-use recursive functions (#2659)
Alex Lam S.L [Tue, 26 Dec 2017 13:25:35 +0000 (21:25 +0800)]
replace single-use recursive functions (#2659)

fixes #2628

6 years agosuppress `inline` within substituted `AST_Scope` (#2658)
Alex Lam S.L [Tue, 26 Dec 2017 10:56:59 +0000 (18:56 +0800)]
suppress `inline` within substituted `AST_Scope` (#2658)

fixes #2657

6 years agoimprove `unused` over duplicate variable names (#2656)
Alex Lam S.L [Tue, 26 Dec 2017 10:29:28 +0000 (18:29 +0800)]
improve `unused` over duplicate variable names (#2656)

6 years agov3.3.2
Alex Lam S.L [Mon, 25 Dec 2017 17:38:56 +0000 (01:38 +0800)]
v3.3.2

6 years agoparse LF & comment correctly (#2653)
Alex Lam S.L [Mon, 25 Dec 2017 17:38:01 +0000 (01:38 +0800)]
parse LF & comment correctly (#2653)

fixes #2652

6 years agov3.3.1
Alex Lam S.L [Sun, 24 Dec 2017 19:08:28 +0000 (03:08 +0800)]
v3.3.1

6 years agoadd `html-minifier` to benchmarks (#2646)
Alex Lam S.L [Sun, 24 Dec 2017 19:07:46 +0000 (03:07 +0800)]
add `html-minifier` to benchmarks (#2646)

6 years agofix infinite loop during `inline` (#2645)
Alex Lam S.L [Sun, 24 Dec 2017 17:57:11 +0000 (01:57 +0800)]
fix infinite loop during `inline` (#2645)

fixes #2644

6 years agov3.3.0
Alex Lam S.L [Sun, 24 Dec 2017 09:34:56 +0000 (17:34 +0800)]
v3.3.0

6 years agofix comments output & improve `/*@__PURE__*/`
Alex Lam S.L [Sun, 24 Dec 2017 04:38:45 +0000 (12:38 +0800)]
fix comments output & improve `/*@__PURE__*/`

- fix whitespace around comments
- fix comment parsing around parentheses
- consider parentheses when parsing `/*@__PURE__*/`
- remove all `/*@__PURE__*/` on output

fixes #2638

6 years agofix corner cases with `collapse_vars`, `inline` & `reduce_vars` (#2637)
Alex Lam S.L [Sat, 23 Dec 2017 17:24:12 +0000 (01:24 +0800)]
fix corner cases with `collapse_vars`, `inline` & `reduce_vars` (#2637)

fixes #2630

6 years agofix escape analysis on `AST_PropAccess` (#2636)
Alex Lam S.L [Sat, 23 Dec 2017 16:36:46 +0000 (00:36 +0800)]
fix escape analysis on `AST_PropAccess` (#2636)

6 years agomake comments output more robust (#2633)
Alex Lam S.L [Thu, 21 Dec 2017 20:59:54 +0000 (04:59 +0800)]
make comments output more robust (#2633)

- improve handling of comments right after `return`
- retain comments after `OutputStream`
- preserve trailing comments
- fix handling of new line before comments
- handle comments around parentheses

fixes #88
fixes #112
fixes #218
fixes #372
fixes #2629

6 years agoextend `test/ufuzz.js` to `inline` & `reduce_funcs` (#2620)
Alex Lam S.L [Wed, 20 Dec 2017 15:52:18 +0000 (23:52 +0800)]
extend `test/ufuzz.js` to `inline` & `reduce_funcs` (#2620)

- forward call `fN()`
- allow forward call functions to be single-use
- avoid generating `AST_Defun` within blocks

6 years agoremove AST hack from `inline` (#2627)
Alex Lam S.L [Wed, 20 Dec 2017 09:05:53 +0000 (17:05 +0800)]
remove AST hack from `inline` (#2627)

6 years agodisable `hoist_funs` by default (#2626)
Alex Lam S.L [Wed, 20 Dec 2017 09:05:40 +0000 (17:05 +0800)]
disable `hoist_funs` by default (#2626)

6 years agoavoid `inline` of function with special argument names (#2625)
Alex Lam S.L [Tue, 19 Dec 2017 18:48:04 +0000 (02:48 +0800)]
avoid `inline` of function with special argument names (#2625)

6 years agofix `inline` after single-use `reduce_vars` (#2623)
Alex Lam S.L [Tue, 19 Dec 2017 14:19:33 +0000 (22:19 +0800)]
fix `inline` after single-use `reduce_vars` (#2623)

6 years agoTransform can be simplified when clone is not done. (#2621)
Ondřej Španěl [Tue, 19 Dec 2017 09:56:16 +0000 (10:56 +0100)]
Transform can be simplified when clone is not done. (#2621)

6 years agoadd test for #2613 (#2618)
Alex Lam S.L [Mon, 18 Dec 2017 21:22:05 +0000 (05:22 +0800)]
add test for #2613 (#2618)

6 years agohandle global constant collision with local variable after `inline` (#2617)
Alex Lam S.L [Mon, 18 Dec 2017 19:05:30 +0000 (03:05 +0800)]
handle global constant collision with local variable after `inline` (#2617)

fixes #2616

6 years agocompress `apply()` & `call()` of `function` (#2613)
Alex Lam S.L [Mon, 18 Dec 2017 08:23:39 +0000 (16:23 +0800)]
compress `apply()` & `call()` of `function` (#2613)

- `fn.apply(a, [ ... ])` => `fn.call(a, ...)`
- `fn.call(a, ... )` => `a, fn(...)`

where `fn` can be `function` literal or symbol reference linked through `reduce_vars`

6 years agodrop property assignment to constants (#2612)
Alex Lam S.L [Mon, 18 Dec 2017 04:07:53 +0000 (12:07 +0800)]
drop property assignment to constants (#2612)

6 years agoimprove transversal efficiency in `collapse_vars` (#2611)
Alex Lam S.L [Sun, 17 Dec 2017 19:00:05 +0000 (03:00 +0800)]
improve transversal efficiency in `collapse_vars` (#2611)

fixes #2603

6 years agoexport `parse()` (#2608)
Alex Lam S.L [Sun, 17 Dec 2017 15:12:23 +0000 (23:12 +0800)]
export `parse()` (#2608)

6 years agoimprove `reset_opt_flags()` (#2610)
Alex Lam S.L [Sun, 17 Dec 2017 15:01:08 +0000 (23:01 +0800)]
improve `reset_opt_flags()` (#2610)

6 years agoaccount for `catch` variable when `inline` (#2605)
Alex Lam S.L [Sat, 16 Dec 2017 07:21:09 +0000 (15:21 +0800)]
account for `catch` variable when `inline` (#2605)

fixes #2604

6 years agofix nested `inline` (#2602)
Alex Lam S.L [Fri, 15 Dec 2017 18:16:35 +0000 (02:16 +0800)]
fix nested `inline` (#2602)

fixes #2601

6 years agofix escape analysis on `||` and `&&` (#2600)
Alex Lam S.L [Fri, 15 Dec 2017 11:48:14 +0000 (19:48 +0800)]
fix escape analysis on `||` and `&&` (#2600)

fixes #2598

6 years agofix `dead_code` on nested `try` (#2599)
Alex Lam S.L [Fri, 15 Dec 2017 11:41:28 +0000 (19:41 +0800)]
fix `dead_code` on nested `try` (#2599)

fixes #2597

6 years agofix `reduce_vars` on `do...while` (#2596)
Alex Lam S.L [Fri, 15 Dec 2017 08:33:19 +0000 (16:33 +0800)]
fix `reduce_vars` on `do...while` (#2596)

6 years agohandle `inline` of function arguments (#2590)
Alex Lam S.L [Fri, 15 Dec 2017 05:28:30 +0000 (13:28 +0800)]
handle `inline` of function arguments (#2590)

fixes #2476

6 years agoinline single-use `function` across loop (#2594)
Alex Lam S.L [Thu, 14 Dec 2017 11:24:54 +0000 (19:24 +0800)]
inline single-use `function` across loop (#2594)

6 years agofix `reduce_vars` on single `AST_Defun` reference across loop (#2593)
Alex Lam S.L [Thu, 14 Dec 2017 10:47:05 +0000 (18:47 +0800)]
fix `reduce_vars` on single `AST_Defun` reference across loop (#2593)

6 years agoimprove `reduce_vars` (#2592)
Alex Lam S.L [Thu, 14 Dec 2017 07:32:13 +0000 (15:32 +0800)]
improve `reduce_vars` (#2592)

- account for hoisting nature of `var`

6 years agoimprove `collapse_vars` (#2591)
Alex Lam S.L [Thu, 14 Dec 2017 07:31:35 +0000 (15:31 +0800)]
improve `collapse_vars` (#2591)

- handle single-use assignments other than `AST_VarDef`
- scan `AST_Call` for candidates

6 years agoimprove `dead_code` tests (#2589)
kzc [Thu, 14 Dec 2017 04:12:06 +0000 (23:12 -0500)]
improve `dead_code` tests (#2589)

for #2588

6 years agofix `dead_code` on `return`/`throw` within `try` (#2588)
Alex Lam S.L [Wed, 13 Dec 2017 20:38:21 +0000 (04:38 +0800)]
fix `dead_code` on `return`/`throw` within `try` (#2588)

6 years agodrop local assign-only variable in `return` (#2587)
Alex Lam S.L [Wed, 13 Dec 2017 18:59:59 +0000 (02:59 +0800)]
drop local assign-only variable in `return` (#2587)

6 years agofold `cascade` functionality into `collapse_vars` (#2586)
Alex Lam S.L [Wed, 13 Dec 2017 17:20:36 +0000 (01:20 +0800)]
fold `cascade` functionality into `collapse_vars` (#2586)

6 years agorecover lost opportunities from #2574 (#2584)
Alex Lam S.L [Wed, 13 Dec 2017 10:20:53 +0000 (18:20 +0800)]
recover lost opportunities from #2574 (#2584)

6 years agoimprove `collapse_vars` on side-effect-free replacements (#2583)
Alex Lam S.L [Tue, 12 Dec 2017 20:52:54 +0000 (04:52 +0800)]
improve `collapse_vars` on side-effect-free replacements (#2583)

6 years agominor clean-up for IIFE (#2582)
Alex Lam S.L [Tue, 12 Dec 2017 17:27:26 +0000 (01:27 +0800)]
minor clean-up for IIFE (#2582)

- faster exact type match
- aggressively convert to `!`

6 years agoavoid `Function.prototype` pollution by `test/sandbox.js` (#2581)
Alex Lam S.L [Mon, 11 Dec 2017 21:02:01 +0000 (05:02 +0800)]
avoid `Function.prototype` pollution by `test/sandbox.js` (#2581)

6 years agofix `AST_VarDef.may_throw()` (#2580)
Alex Lam S.L [Mon, 11 Dec 2017 19:30:25 +0000 (03:30 +0800)]
fix `AST_VarDef.may_throw()` (#2580)

6 years agofix `collapse_vars` on `switch` (#2578)
Alex Lam S.L [Mon, 11 Dec 2017 10:11:09 +0000 (18:11 +0800)]
fix `collapse_vars` on `switch` (#2578)

6 years agoremove unused code (#2579)
Alex Lam S.L [Mon, 11 Dec 2017 09:39:08 +0000 (17:39 +0800)]
remove unused code (#2579)

fixes #2577

6 years agoescape consecutive unpaired surrogates (#2576)
Alex Lam S.L [Sun, 10 Dec 2017 17:15:44 +0000 (01:15 +0800)]
escape consecutive unpaired surrogates (#2576)

fixes #2569

6 years agorename tests (#2575)
Alex Lam S.L [Sun, 10 Dec 2017 16:24:54 +0000 (00:24 +0800)]
rename tests (#2575)

6 years agohandle exceptional flow correctly in `collapse_vars` (#2574)
Alex Lam S.L [Sun, 10 Dec 2017 16:16:02 +0000 (00:16 +0800)]
handle exceptional flow correctly in `collapse_vars` (#2574)

fixes #2571

6 years agov3.2.2
Alex Lam S.L [Sun, 10 Dec 2017 05:46:17 +0000 (13:46 +0800)]
v3.2.2

6 years agoimprove `unused` on assign-only symbols (#2568)
Alex Lam S.L [Fri, 8 Dec 2017 22:19:29 +0000 (06:19 +0800)]
improve `unused` on assign-only symbols (#2568)

6 years agofix escape analysis for `AST_Throw` (#2564)
Alex Lam S.L [Thu, 7 Dec 2017 18:54:37 +0000 (02:54 +0800)]
fix escape analysis for `AST_Throw` (#2564)

6 years agofix escape analysis for `AST_Conditional` & `AST_Sequence` (#2563)
Alex Lam S.L [Thu, 7 Dec 2017 17:50:38 +0000 (01:50 +0800)]
fix escape analysis for `AST_Conditional` & `AST_Sequence` (#2563)

fixes #2560

6 years agoaccount for side-effects in conditional call inversion (#2562)
Alex Lam S.L [Thu, 7 Dec 2017 17:15:31 +0000 (01:15 +0800)]
account for side-effects in conditional call inversion (#2562)

fixes #2560

6 years agoeliminate noop calls more aggressively (#2559)
Alex Lam S.L [Wed, 6 Dec 2017 17:22:08 +0000 (01:22 +0800)]
eliminate noop calls more aggressively (#2559)

6 years agoimprove `if_return` (#2558)
Alex Lam S.L [Wed, 6 Dec 2017 17:01:52 +0000 (01:01 +0800)]
improve `if_return` (#2558)

`return void x()` => `x()`

6 years agov3.2.1
Alex Lam S.L [Sun, 3 Dec 2017 03:39:51 +0000 (11:39 +0800)]
v3.2.1

6 years agofix `dead_code` on `for` (#2552)
Alex Lam S.L [Sat, 2 Dec 2017 07:46:05 +0000 (15:46 +0800)]
fix `dead_code` on `for` (#2552)

6 years agomore tests for #2535 (#2551)
Alex Lam S.L [Fri, 1 Dec 2017 18:26:56 +0000 (02:26 +0800)]
more tests for #2535 (#2551)

6 years agoimprove `evaluate` on `typeof` (#2550)
Alex Lam S.L [Fri, 1 Dec 2017 18:18:33 +0000 (02:18 +0800)]
improve `evaluate` on `typeof` (#2550)

- gated through `typeofs`

6 years agoimprove boolean compression (#2548)
Alex Lam S.L [Fri, 1 Dec 2017 14:41:35 +0000 (22:41 +0800)]
improve boolean compression (#2548)

fixes #2535

6 years agoimprove switch case compression (#2547)
Alex Lam S.L [Fri, 1 Dec 2017 06:32:00 +0000 (14:32 +0800)]
improve switch case compression (#2547)

6 years agoimprove `AST_For.init` & `AST_Switch.expression` compression (#2546)
Alex Lam S.L [Fri, 1 Dec 2017 04:53:59 +0000 (12:53 +0800)]
improve `AST_For.init` & `AST_Switch.expression` compression (#2546)

6 years agoconvert to number under boolean context (#2545)
Alex Lam S.L [Fri, 1 Dec 2017 04:52:36 +0000 (12:52 +0800)]
convert to number under boolean context (#2545)

6 years agoimprove compression of `if` conditions (#2544)
Alex Lam S.L [Thu, 30 Nov 2017 22:18:31 +0000 (06:18 +0800)]
improve compression of `if` conditions (#2544)

6 years agoimprove compression of loop conditions (#2543)
Alex Lam S.L [Thu, 30 Nov 2017 21:52:33 +0000 (05:52 +0800)]
improve compression of loop conditions (#2543)