Skip to content

Commit

Permalink
inline functions: always clone
Browse files Browse the repository at this point in the history
  • Loading branch information
gdh1995 committed Aug 26, 2021
1 parent ea9328d commit d41e2f0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
23 changes: 23 additions & 0 deletions .vscode/launch.json
@@ -0,0 +1,23 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "test:a",
"program": "${workspaceFolder}/bin/terser",
"args": [
"R:/working/a.js", "-c", "passes=2",
],
"env": {
"PATH": "D:\\Program Files\\nodejs;${env:PATH}",
},
"skipFiles": [
"<node_internals>/**"
]
},
]
}
4 changes: 1 addition & 3 deletions lib/compress/index.js
Expand Up @@ -2166,9 +2166,7 @@ def_optimize(AST_Call, function(self, compressor) {
if (can_inline && has_annotation(self, _INLINE)) {
set_flag(fn, SQUEEZED);
fn = make_node(fn.CTOR === AST_Defun ? AST_Function : fn.CTOR, fn, fn);
if (!exp.definition().single_use) {
fn = fn.clone(true);
}
fn = fn.clone(true);
fn.figure_out_scope({}, {
parent_scope: find_scope(compressor),
toplevel: compressor.get_toplevel()
Expand Down

0 comments on commit d41e2f0

Please sign in to comment.