alexlamsl
686a496b1c
remove unused AST_Scope.nesting & AST_SymbolRef.frame
...
they are computed but never used
closes #1444
2017-02-18 18:59:40 +08:00
Richard van Velzen
4bd31607f6
Merge branch 'master' into harmony
2017-01-26 13:02:22 +01:00
Alex Lam S.L
1eaa211e09
fix mangling collision with keep_fnames ( #1431 )
...
* fix mangling collision with keep_fnames
fixes #1423
* pass mangle options to figure_out_scope()
bring command-line in line with minify()
2017-01-26 12:18:28 +01:00
Alex Lam S.L
0d7d4918eb
augment evaluate to extract within objects ( #1425 )
...
- gated by `unsafe`
- replaces previous optimisation specific to String.length
- "123"[0] => 1
- [1, 2, 3][0] => 1
- [1, 2, 3].length => 3
- does not apply to objects with overridden prototype functions
2017-01-26 12:14:18 +01:00
alexlamsl
48284844a4
add missing LHS cases which global_defs should avoid
2017-01-19 21:06:28 +01:00
Anthony Van de Gejuchte
5f6825f9ec
Introduce is_block_scope to AST_Node to determine block scope.
...
Will return false if AST_Node is instance of AST_Scope for now.
2016-10-24 21:28:32 +02:00
Richard van Velzen
b7bb706150
Merge branch 'master' into harmony
2016-10-23 22:11:27 +02:00
Jann Horn
266ddd9639
fix uses_arguments handling (broken since 6605d15783)
...
Using the symbol declaration tracking of UglifyJS doesn't make sense here
anyway, `arguments` always comes from something in the current scope.
fixes #1299
2016-10-23 21:29:18 +02:00
Anthony Van de Gejuchte
32c2cc33bb
Improve binding patterns for arrow functions
2016-10-23 21:13:12 +02:00
alexlamsl
4761d07e0b
Optimize unmodified variables
2016-10-01 11:36:11 +02:00
Richard van Velzen
c644c1292d
Merge branch 'master' into harmony
2016-08-15 09:09:04 +02:00
kzc
eb63fece2f
Fix mangle with option keep_fnames=true for Safari.
...
Fixes : #1202
2016-07-15 13:18:14 +02:00
Anthony Van de Gejuchte
6fd9b338dd
Merge branch 'master' into harmony
2016-07-03 21:35:00 +02:00
Anthony Van de Gejuchte
d8d4e71b9e
Fix uses_with/uses_eval/directives state in block scope
2016-07-01 15:43:17 +02:00
kzc
02c638209e
Enable --screw-ie8 by default.
...
catch identifier is mangled correctly for ES5 standards-compliant JS engines by default.
Unconditionally use the ie8 if/do-while workaround whether or not --screw-ie8 is enabled.
To support non-standard ie8 javascript use: uglifyjs --support-ie8
2016-06-30 21:49:48 +02:00
Anthony Van de Gejuchte
dcfc514c38
Improve yield support and restrict usage of strict
...
- Partially reverting 91cdb93e57 and eaf3911c31 and reimplement
- Add generators support for objects and classes
- Only classes can have static methods so restrict use of it
Special thanks to @rvanvelzen and @kzc for reviewing this patch and
providing constructive feedback over and over again.
2016-06-09 22:22:15 +02:00
Richard van Velzen
f94497d1d6
Merge branch 'master' into harmony
2016-04-18 15:50:35 +02:00
kzc
45ddb9caeb
Speedup unused compress option for already minified code
...
Fixes : #321 #917 #1022
2016-03-28 17:58:50 -04:00
Fábio Santos
634f231b78
First class block scope
...
- Make let, const, and class symbols be declared in a block scope.
- Piggy back on existing catch symbol implementation to get block-aware mangling working
- Make sure unused block-scoped declarations can be dropped
- Don't eliminate a block if it has a block-scoped declaration
- Remove silly empty anonymous blocks left over from drop_unused
- AST_Toplevel now gets to call drop_unused too, since block-scoped variables aren't global!
- Don't consider block declarations global
2016-03-27 19:40:20 +02:00
Fábio Santos
0bc4f6edb4
Don't mangle exported symbols
2016-03-14 12:54:05 +01:00
Fábio Santos
86b5248837
Mangling externally imported names by using aliasing
2016-03-14 12:54:05 +01:00
kzc
102d1b9137
#877 Ignore mangle sort option
2016-02-27 15:33:10 -05:00
alexlamsl
6547437725
preserve ThisBinding for side_effects
2016-02-17 19:34:01 +01:00
Darío Javier Cravero
0b303379c0
fix: don't fail if definition is undefined
...
Running `uglifyjs --verbose --compress --mangle --screw-ie8 class.js`
with
`class.js`:
```
class Foo {
bar() {
}
}
```
Fails with:
```
undefined:4041
return this.definition().unmangleable(options);
TypeError: Cannot read property 'unmangleable' of undefined
...
```
2016-02-10 10:17:32 +01:00
Mihai Bazon
915f907186
Add start/end in the arguments definition
...
(keeps my https://github.com/mishoo/jsinfo.el working)
2016-01-27 11:36:03 +02:00
Samuel Reed
1b703349cf
Tighten up @const regex.
2016-01-20 11:35:45 -06:00
Samuel Reed
4a7179ff91
Simplify by skipping extra tree walk.
2016-01-20 11:03:41 -06:00
Samuel Reed
f97da4294a
Use TreeWalker for more accurate @const results and update tests
2016-01-20 10:54:00 -06:00
Samuel Reed
8b71c6559b
Mark vars with /** @const */ pragma as consts so they can be eliminated.
...
Fixes older browser support for consts and allows more flexibility
in dead code removal.
2016-01-19 13:23:02 -06:00
Anthony Van de Gejuchte
6605d15783
Never mangle arguments and keep them in their scope
...
Fixes #892
Helped-by: kzc
2016-01-14 19:45:52 +01:00
Richard van Velzen
7f3dbb6df7
Merge branch 'master' into harmony
2015-12-26 17:59:38 +01:00
Fábio Santos
e076abdbf2
Mangle class names correctly
2015-11-21 13:59:18 +00:00
Fábio Santos
425613b0d2
mangle class names
2015-11-21 12:20:20 +00:00
Mihai Bazon
c898a26117
Build label def/refs info when figuring out scope
...
Fix #862
2015-11-12 11:48:06 +02:00
Mihai Bazon
7691bebea5
Rework has_directive
...
It's now available during tree walking, i.e. walker.has_directive("use
asm"), rather than as part of the scope. It's thus no longer necessary
to call `figure_out_scope` before codegen. Added special bits in the
code generator to overcome the fact that it doesn't inherit from
TreeWalker.
Fix #861
2015-11-11 22:15:25 +02:00
Richard van Velzen
b14496c742
Merge branch 'master' into harmony
...
Conflicts:
lib/compress.js
2015-10-12 08:54:44 +02:00
kzc
593677d2ff
Add proper support for "use asm"; blocks. Disable -c optimization within "use asm"; sections and preserve floating point literals in their original form. Non-asm.js sections are optimized as before. Asm.js sections can still be mangled and minified of whitespace. No special command line flags are required.
2015-10-07 10:00:28 +02:00
Fábio Santos
e99bc914ca
Do not mangle a name if it is in a destructuring vardef.
2015-08-21 12:04:26 +02:00
Fábio Santos
e80ed38772
Super!
2015-08-07 02:44:53 +01:00
Fábio Santos
32f76f7ff8
Starting destructuring.
2015-07-29 14:54:45 +02:00
Mihai Bazon
aa45f6586e
rename --prop-cache to --name-cache
...
... and support storing there variable names as well, to help with multiple
invocations when mangling toplevel.
2015-03-16 13:16:30 +02:00
Richard van Velzen
e37b67d013
Add an option to prevent function names from being mangled
...
See #552 . This is mostly useful for having the actual function names in traces.
2015-01-04 21:48:43 +01:00
Cheng Liangyu
fe06fc85d3
fix base54
2014-12-01 13:16:44 +08:00
Arnavion
7be680d3f8
Don't warn for an unreferenced exception symbol in a catch block.
2014-09-12 21:01:19 -07:00
Mihai Bazon
bf30dc3038
Mangle name of exception when --screw-ie8. Fix #430 .
...
The effect of not mangling it was visible only with --screw-ie8 (otherwise
the names would be mangled exactly because they leaked into the parent
scope).
2014-02-14 13:58:14 +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
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
b214d3786f
Fix typo
2013-10-29 15:53:54 +02:00