Files
javascript-obfuscator-javas…/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts
T
2016-05-24 17:32:33 +03:00

49 lines
1.2 KiB
TypeScript

import { BlockScopeNode } from "../../types/BlockScopeNode";
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: BlockScopeNode): void {
NodeUtils.appendNode(blockScopeNode.body, this.getNode());
}
/**
* @returns any
*/
protected getNodeStructure (): any {
return {
'type': NodeType.ExpressionStatement,
'expression': {
'type': NodeType.CallExpression,
'callee': {
'type': NodeType.Identifier,
'name': this.debugProtectionFunctionName
},
'arguments': []
}
};
}
}