保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 23b60dc1975db38c280d8a123aff97544d1673e0
PAMapp/node_modules/terser-webpack-plugin/node_modules/terser/lib/scope.js
@@ -116,6 +116,11 @@
let function_defs = null;
let unmangleable_names = null;
/**
 * When defined, there is a function declaration somewhere that's inside of a block.
 * See https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-block-level-function-declarations-web-legacy-compatibility-semantics
*/
let scopes_with_block_defuns = null;
class SymbolDef {
    constructor(scope, orig, init) {
@@ -666,6 +671,15 @@
});
function next_mangled(scope, options) {
    let defun_scope;
    if (
        scopes_with_block_defuns
        && (defun_scope = scope.get_defun_scope())
        && scopes_with_block_defuns.has(defun_scope)
    ) {
        scope = defun_scope;
    }
    var ext = scope.enclosed;
    var nth_identifier = options.nth_identifier;
    out: while (true) {
@@ -781,6 +795,8 @@
    }
    const mangled_names = this.mangled_names = new Set();
    unmangleable_names = new Set();
    if (options.cache) {
        this.globals.forEach(collect);
        if (options.cache.props) {
@@ -797,6 +813,13 @@
            descend();
            lname = save_nesting;
            return true;        // don't descend again in TreeWalker
        }
        if (
            node instanceof AST_Defun
            && !(tw.parent() instanceof AST_Scope)
        ) {
            scopes_with_block_defuns = scopes_with_block_defuns || new Set();
            scopes_with_block_defuns.add(node.parent_scope.get_defun_scope());
        }
        if (node instanceof AST_Scope) {
            node.variables.forEach(collect);
@@ -833,7 +856,6 @@
    this.walk(tw);
    if (options.keep_fnames || options.keep_classnames) {
        unmangleable_names = new Set();
        // Collect a set of short names which are unmangleable,
        // for use in avoiding collisions in next_mangled.
        to_mangle.forEach(def => {
@@ -847,11 +869,12 @@
    function_defs = null;
    unmangleable_names = null;
    scopes_with_block_defuns = null;
    function collect(symbol) {
        const should_mangle = !options.reserved.has(symbol.name)
            && !(symbol.export & MASK_EXPORT_DONT_MANGLE);
        if (should_mangle) {
        if (symbol.export & MASK_EXPORT_DONT_MANGLE) {
            unmangleable_names.add(symbol.name);
        } else if (!options.reserved.has(symbol.name)) {
            to_mangle.push(symbol);
        }
    }