fix mangle on export (#2133)

- `export default ...`
- `export` with `AST_Destructuring`

fixes #2129
This commit is contained in:
Alex Lam S.L
2017-06-21 14:22:09 +08:00
committed by GitHub
parent db877e8729
commit 8709753bfb
3 changed files with 21 additions and 3 deletions

View File

@@ -234,8 +234,14 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
}
function mark_export(def, level) {
if (in_destructuring) {
var i = 0;
do {
level++;
} while (tw.parent(i++) !== in_destructuring);
}
var node = tw.parent(level);
def.export = node instanceof AST_Export && !node.is_default;
def.export = node instanceof AST_Export;
}
});
self.walk(tw);