mishoo/UglifyJS — pull request #351 by mal (2012-04-07 14:43:30+00:00)
Title: Ignore directives when set in a higher scope

###### TL;DR: **Patch removes directives whose effects are already being inherited.**

We've all been there; lovely atomic modules, each in their own scope, each using strict mode. Now it's time to `cat` and `uglify` them. But what's this? Oh no! The strict mode from each scope has been retained, taking up precious bytes, despite them having been made redundant because you diligently set `use strict` in the global scope of your `cat`'d file!

Time to end this travesty!

##### Example

```sh
$ bin/uglifyjs -b -nm in.js > out.js && diff -u10 in.js out.js
```
```diff
--- in.js 2012-04-07 15:31:05.283903931 +0100
+++ out.js 2012-04-07 15:31:56.319904594 +0100
@@ -1,31 +1,25 @@
"use strict";

function a() {
void "a";
function b() {
- "use strict";
void "b";
function c() {
- "use strict";
void "c";
}
function d() {
"salmon";
void "d";
}
}
function e() {
"salmon";
void "e";
function f() {
- "use strict";
- "salmon";
void "f";
for (var i = 0; i < 10; i++) var g = function() {
- "use strict";
- "salmon";
void "g";
}();
}
}
};
\ No newline at end of file
```