Files
javascript-obfuscator-javas…/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts
T
2016-05-30 17:45:12 +03:00

51 lines
1.3 KiB
TypeScript

import { IExpressionStatementNode } from "../../interfaces/nodes/IExpressionStatementNode";
import { TBlockScopeNode } from "../../types/TBlockScopeNode";
import { NodeType } from "../../enums/NodeType";
import { Node } from '../Node';
import { NodeUtils } from "../../NodeUtils";
export class DebugProtectionFunctionCallNode extends Node {
/**
* @type {string}
*/
private debugProtectionFunctionName: string;
/**
* @param debugProtectionFunctionName
*/
constructor (debugProtectionFunctionName: string) {
super();
this.debugProtectionFunctionName = debugProtectionFunctionName;
this.node = this.getNodeStructure();
}
/**
* @param blockScopeNode
*/
public appendNode (blockScopeNode: TBlockScopeNode): void {
NodeUtils.appendNode(blockScopeNode.body, this.getNode());
}
/**
* @returns {IExpressionStatementNode}
*/
protected getNodeStructure (): IExpressionStatementNode {
return {
'type': NodeType.ExpressionStatement,
'expression': {
'type': NodeType.CallExpression,
'callee': {
'type': NodeType.Identifier,
'name': this.debugProtectionFunctionName
},
'arguments': []
}
};
}
}