import Modification from "../../modification"; import * as Shift from "shift-ast"; export default class ProxyRemover extends Modification { private readonly scopeTypes; private readonly proxyExpressionTypes; private shouldRemoveProxyFunctions; private globalScope; /** * Creates a new modification. * @param ast The AST. * @param removeProxyFunctions Whether the functions should be removed. */ constructor(ast: Shift.Script, removeProxyFunctions: boolean); /** * Executes the modification. */ execute(): void; /** * Finds all proxy functions and records them in the according scope. */ private findProxyFunctions; /** * Finds aliases for proxy functions. */ private findAliases; /** * Replaces all usages of proxy functions in a given node. * @param node The node to replace usages in. * @param startScope The scope of the node. */ private replaceProxyFunctionUsages; /** * Removes all proxy functions from a scope and its children. * @param scope The scope to remove proxy functions from. */ private removeProxyFunctions; /** * Returns whether a node is a proxy function declaration. * @param node The AST node. */ private isProxyFunctionDeclaration; /** * Returns whether a node is a proxy function expression variable * declaration. * @param node The AST node. */ private isProxyFunctionExpressionDeclaration; /** * Returns whether a node is a variable reassignment. * @param node The AST node. * @returns Whether. */ private isVariableReassignment; /** * Returns whether a node is a function call. * @param node The AST node. */ private isFunctionCall; }