vanzy-protect
Version:
Epic Obfuscator Yeahhh
37 lines (36 loc) • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fancyForStatement = void 0;
const cfg_1 = require("../config/cfg");
const comment_1 = require("../obfuscate/comment");
const obfuscateName_1 = require("../obfuscate/obfuscateName");
const postElseExpr_1 = require("./postElseExpr");
const rightExpression_1 = require("./rightExpression");
const traverse_1 = require("./traverse");
const variableDeclaration_1 = require("./variableDeclaration");
function fancyForStatement(expr) {
const theKeyword = expr.type === 'ForInStatement' ? 'in' : 'of';
var data = 'for(' + (0, comment_1.comment)(2);
if (expr.left.type === 'VariableDeclaration') {
data += (0, variableDeclaration_1.variableDeclaration)(expr.left);
}
else if (expr.left.type === 'Identifier') {
if ((0, cfg_1.cfg)().transforms.obfuscateNames)
data += (0, obfuscateName_1.obfuscateName)(expr.left.name);
else
data += expr.left.name;
}
else {
data += (0, rightExpression_1.rightExpression)(expr.left);
}
data += ' ' + (0, comment_1.comment)(2) + theKeyword + ' ' + (0, comment_1.comment)(3);
data += (0, rightExpression_1.rightExpression)(expr.right) + (0, comment_1.comment)(3) + ')';
if (expr.body.type === 'BlockStatement') {
data += '{' + (0, traverse_1.traverse)(expr.body.body) + ';}';
}
else {
data += (0, postElseExpr_1.postElseExpr)(expr.body) + ';';
}
return data;
}
exports.fancyForStatement = fancyForStatement;