anobis
Version:
JavaScript obfuscator
72 lines (58 loc) • 2.08 kB
text/typescript
import { injectable, inject } from 'inversify';
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
import { TStatement } from '../../../types/node/TStatement';
import { IOptions } from '../../../interfaces/options/IOptions';
import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
import { initializable } from '../../../decorators/Initializable';
import { AbstractCustomNode } from '../../AbstractCustomNode';
import { Nodes } from '../../../node/Nodes';
import { NodeUtils } from '../../../node/NodeUtils';
()
export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode {
/**
* @type {string}
*/
()
private controlFlowStorageKey: string;
/**
* @type {string}
*/
()
private controlFlowStorageName: string;
/**
* @type {IRandomGenerator}
*/
private readonly randomGenerator: IRandomGenerator;
/**
* @param {IRandomGenerator} randomGenerator
* @param {IOptions} options
*/
constructor (
(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
(ServiceIdentifiers.IOptions) options: IOptions
) {
super(options);
this.randomGenerator = randomGenerator;
}
/**
* @param {string} controlFlowStorageName
* @param {string} controlFlowStorageKey
*/
public initialize (
controlFlowStorageName: string,
controlFlowStorageKey: string
): void {
this.controlFlowStorageName = controlFlowStorageName;
this.controlFlowStorageKey = controlFlowStorageKey;
}
protected getNodeStructure (): TStatement[] {
const structure: TStatement = Nodes.getExpressionStatementNode(
Nodes.getMemberExpressionNode(
Nodes.getIdentifierNode(this.controlFlowStorageName),
Nodes.getIdentifierNode(this.controlFlowStorageKey)
)
);
NodeUtils.parentize(structure);
return [structure];
}
}