support for directives
This commit is contained in:
@@ -742,6 +742,13 @@ function Compressor(options, false_by_default) {
|
||||
|
||||
/* -----[ node squeezers ]----- */
|
||||
|
||||
SQUEEZE(AST_Directive, function(self, compressor){
|
||||
if (self.hoisted || self.scope.has_directive(self.value) !== self.scope) {
|
||||
return new AST_EmptyStatement(self);
|
||||
}
|
||||
return self;
|
||||
});
|
||||
|
||||
SQUEEZE(AST_Debugger, function(self, compressor){
|
||||
if (compressor.option("drop_debugger"))
|
||||
return new AST_EmptyStatement(self);
|
||||
@@ -796,6 +803,10 @@ function Compressor(options, false_by_default) {
|
||||
var vars = {}, vars_found = 0, vardecl = [];
|
||||
var tw = new TreeWalker(function(node){
|
||||
if (node !== self) {
|
||||
if (node instanceof AST_Directive && (hoist_funs || hoist_vars) && !node.hoisted) {
|
||||
hoisted.unshift(node.clone());
|
||||
node.hoisted = true;
|
||||
}
|
||||
if (node instanceof AST_Defun && hoist_funs && !node.hoisted) {
|
||||
hoisted.push(node.clone());
|
||||
node.hoisted = true;
|
||||
|
||||
Reference in New Issue
Block a user