vanzy-protect
Version:
Epic Obfuscator Yeahhh
34 lines (33 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.forStatement = void 0;
const comment_1 = require("../obfuscate/comment");
const Randomizer_1 = require("../random/Randomizer");
const forConditionSection_1 = require("./forConditionSection");
const leftExpression_1 = require("./leftExpression");
const postElseExpr_1 = require("./postElseExpr");
const traverse_1 = require("./traverse");
function forStatement(expr) {
var data = '';
const newthis = Randomizer_1.Randomizer.INSTANCE.randIName(64);
data += `const ${(0, comment_1.comment)(3)}${newthis}${(0, comment_1.comment)(3)}=${(0, comment_1.comment)(2)}${(0, leftExpression_1.getThis)()};`;
leftExpression_1.thisStack.push(newthis);
data += '(function(){';
data += (0, comment_1.comment)(2);
data += (0, forConditionSection_1.forConditionSection)(expr.init) + ';';
data += (0, comment_1.comment)(2) + 'while(';
data += (0, forConditionSection_1.forConditionSection)(expr.test);
data += (0, comment_1.comment)(1) + ')';
if (expr.body.type === 'BlockStatement') {
data += '{' + (0, traverse_1.traverse)(expr.body.body) + ';\n';
data += (0, forConditionSection_1.forConditionSection)(expr.update) + '}';
}
else {
data += '{' + (0, postElseExpr_1.postElseExpr)(expr) + ';\n' + (0, forConditionSection_1.forConditionSection)(expr.update) + '}';
}
data += '})';
data += (0, comment_1.comment)(1) + '()';
leftExpression_1.thisStack.pop();
return data;
}
exports.forStatement = forStatement;