import * as format from 'string-template';
import { TNodeWithBlockStatement } from '../../types/node/TNodeWithBlockStatement';
import { TObfuscationEvent } from '../../types/event-emitters/TObfuscationEvent';
import { IOptions } from '../../interfaces/options/IOptions';
import { ObfuscationEvents } from '../../enums/ObfuscationEvents';
import { DebugProtectionFunctionCallTemplate } from '../../templates/custom-nodes/debug-protection-nodes/debug-protection-function-call-node/DebufProtectionFunctionCallTemplate';
import { AbstractCustomNode } from '../AbstractCustomNode';
import { NodeAppender } from '../../node/NodeAppender';
export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
/**
* @type {TObfuscationEvent}
*/
protected readonly appendEvent: TObfuscationEvent = ObfuscationEvents.BeforeObfuscation;
/**
* @type {string}
*/
private debugProtectionFunctionName: string;
/**
* @param debugProtectionFunctionName
* @param options
*/
constructor (debugProtectionFunctionName: string, options: IOptions) {
super(options);
this.debugProtectionFunctionName = debugProtectionFunctionName;
}
/**
* @param blockScopeNode
*/
public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
NodeAppender.appendNode(blockScopeNode, this.getNode());
}
/**
* @returns {string}
*/
public getCode (): string {
return format(DebugProtectionFunctionCallTemplate(), {
debugProtectionFunctionName: this.debugProtectionFunctionName
});
}
}
|