module-level scope
This commit is contained in:
parent
041482fd44
commit
924f7bc3a9
|
|
@ -77,7 +77,7 @@ function minify(files, options) {
|
||||||
set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
|
set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
|
||||||
set_shorthand("keep_classnames", options, [ "compress", "mangle" ]);
|
set_shorthand("keep_classnames", options, [ "compress", "mangle" ]);
|
||||||
set_shorthand("keep_fnames", 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("safari10", options, [ "mangle", "output" ]);
|
||||||
set_shorthand("toplevel", options, [ "compress", "mangle" ]);
|
set_shorthand("toplevel", options, [ "compress", "mangle" ]);
|
||||||
set_shorthand("warnings", options, [ "compress" ]);
|
set_shorthand("warnings", options, [ "compress" ]);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,11 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
|
||||||
|
|
||||||
// pass 1: setup scope chaining and handle definitions
|
// pass 1: setup scope chaining and handle definitions
|
||||||
var self = this;
|
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 labels = new Dictionary();
|
||||||
var defun = null;
|
var defun = null;
|
||||||
var in_destructuring = null;
|
var in_destructuring = null;
|
||||||
|
|
|
||||||
|
|
@ -1617,3 +1617,15 @@ module_enables_strict_mode: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_mangle_scope: {
|
||||||
|
mangle = {
|
||||||
|
module: true
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
let a = 10;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
let e = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user