Skip to content

Commit

Permalink
upgrade AST<->ESTree translation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl committed Apr 25, 2021
1 parent a1a212f commit 43d5aba
Show file tree
Hide file tree
Showing 8 changed files with 772 additions and 158 deletions.
4 changes: 3 additions & 1 deletion bin/uglifyjs
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,11 @@ function run() {
if (options.parse.acorn) {
files = convert_ast(function(toplevel, name) {
return require("acorn").parse(files[name], {
ecmaVersion: "latest",
locations: true,
program: toplevel,
sourceFile: name
sourceFile: name,
sourceType: "module",
});
});
} else if (options.parse.spidermonkey) {
Expand Down
4 changes: 4 additions & 0 deletions lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -6562,6 +6562,10 @@ merge(Compressor.prototype, {
}
return insert_statements(body, node, in_list);
}
if (node instanceof AST_Import) {
if (node.properties && node.properties == 0) node.properties = null;
return node;
}
if (node instanceof AST_Sequence) {
if (node.expressions.length > 1) return;
return maintain_this_binding(compressor, tt.parent(), node, node.expressions[0]);
Expand Down
Loading

0 comments on commit 43d5aba

Please sign in to comment.