-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/minifier): Fix a bug related to inliner and the variable scopi…
- Loading branch information
Showing
10 changed files
with
223 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
var a;v=(a=r,b=>a.map(t=>{if(t)return t.foo})); | ||
let a;v=(a=r,b=>a.map(t=>{if(t)return t.foo})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"jsx": true | ||
}, | ||
"transform": null, | ||
"target": "es2015", | ||
"loose": true, | ||
"externalHelpers": false, | ||
"minify": { | ||
"mangle": { | ||
"toplevel": false, | ||
"keep_classnames": false, | ||
"keep_fnames": false, | ||
"keep_private_props": false, | ||
"ie8": false, | ||
"safari10": false | ||
}, | ||
"compress": { | ||
"arguments": false, | ||
"arrows": true, | ||
"booleans": true, | ||
"booleans_as_integers": false, | ||
"collapse_vars": true, | ||
"comparisons": true, | ||
"computed_props": true, | ||
"conditionals": true, | ||
"dead_code": true, | ||
"directives": true, | ||
"drop_console": false, | ||
"drop_debugger": true, | ||
"evaluate": true, | ||
"expression": false, | ||
"hoist_funs": false, | ||
"hoist_props": true, | ||
"hoist_vars": false, | ||
"if_return": true, | ||
"join_vars": true, | ||
"keep_classnames": false, | ||
"keep_fargs": true, | ||
"keep_fnames": false, | ||
"keep_infinity": false, | ||
"loops": true, | ||
"negate_iife": true, | ||
"properties": true, | ||
"reduce_funcs": false, | ||
"reduce_vars": false, | ||
"side_effects": true, | ||
"switches": true, | ||
"typeofs": true, | ||
"unsafe": false, | ||
"unsafe_arrows": false, | ||
"unsafe_comps": false, | ||
"unsafe_Function": false, | ||
"unsafe_math": false, | ||
"unsafe_symbols": false, | ||
"unsafe_methods": false, | ||
"unsafe_proto": false, | ||
"unsafe_regexp": false, | ||
"unsafe_undefined": false, | ||
"unused": true, | ||
"const_to_let": true, | ||
"pristine_globals": true | ||
} | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"isModule": false, | ||
"minify": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function withLog(methods) { | ||
const result = {} | ||
for (const methodName in methods) { | ||
result[methodName] = ((methodName) => function () { | ||
console.log(methodName + ' invoked') | ||
return methods[methodName].apply(this, arguments) | ||
})(methodName) | ||
} | ||
return result | ||
} | ||
|
||
function main() { | ||
const result = withLog({ | ||
test() { | ||
console.log('method test executed') | ||
}, | ||
another() { | ||
console.log('method another executed') | ||
} | ||
}) | ||
|
||
result.test() | ||
} | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function withLog(t) { | ||
let e = {}; | ||
for(let o in t){ | ||
let n; | ||
e[o] = (n = o, function() { | ||
return console.log(n + ' invoked'), t[n].apply(this, arguments); | ||
}); | ||
} | ||
return e; | ||
} | ||
function main() { | ||
withLog({ | ||
test () { | ||
console.log('method test executed'); | ||
}, | ||
another () { | ||
console.log('method another executed'); | ||
} | ||
}).test(); | ||
} | ||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
const func_bag = { | ||
leak: leak | ||
}; | ||
var x; | ||
let x; | ||
leak(x = func_bag.leak); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters