module-level scope

This commit is contained in:
Fábio Santos 2018-03-15 15:17:45 +00:00
parent 041482fd44
commit 924f7bc3a9
3 changed files with 18 additions and 2 deletions

View File

@ -77,7 +77,7 @@ function minify(files, options) {
set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
set_shorthand("keep_classnames", options, [ "compress", "mangle" ]);
set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
set_shorthand("module", options, [ "compress" ]);
set_shorthand("module", options, [ "compress", "mangle" ]);
set_shorthand("safari10", options, [ "mangle", "output" ]);
set_shorthand("toplevel", options, [ "compress", "mangle" ]);
set_shorthand("warnings", options, [ "compress" ]);

View File

@ -110,7 +110,11 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
// pass 1: setup scope chaining and handle definitions
var self = this;
var scope = self.parent_scope = null;
var scope = null;
if (options.module) {
scope = new AST_Scope(self);
}
self.parent_scope = scope;
var labels = new Dictionary();
var defun = null;
var in_destructuring = null;

View File

@ -1617,3 +1617,15 @@ module_enables_strict_mode: {
}
}
}
module_mangle_scope: {
mangle = {
module: true
}
input: {
let a = 10;
}
expect: {
let e = 10;
}
}