import Modification from "../../modification"; import * as Shift from "shift-ast"; export default class ArrayUnpacker extends Modification { private readonly scopeTypes; private shouldRemoveArrays; private globalScope; /** * Creates a new modification. * @param ast The AST. * @param shouldRemoveArrays Whether the arrays should be removed. */ constructor(ast: Shift.Script, removeArrays: boolean); /** * Executes the modification. */ execute(): void; /** * Finds all literal arrays and stores them in the according scope. */ private findArrays; /** * Replaces all usages of literal arrays. */ private unpackArrays; /** * Removes all the (suitable) arrays in a scope and its children. * @param scope The scope to remove arrays from. */ private removeArrays; /** * Returns whether a node is a literal array declaration. * @param node The AST node. */ private isLiteralArrayDeclaration; /** * Returns whether a node is accessing an index of an array. * @param node The AST node. */ private isSimpleArrayAccess; }