generateCode() now not static

This commit is contained in:
sanex3339
2016-11-25 17:44:25 +03:00
parent 12bf25cf3b
commit 1346570151
3 changed files with 24 additions and 24 deletions
+4 -6
View File
@@ -47,21 +47,20 @@ export class JavaScriptObfuscatorInternal {
/**
* @param sourceCode
* @param astTree
* @param options
*/
private static generateCode (sourceCode: string, astTree: ESTree.Program, options: IOptions): IGeneratorOutput {
private generateCode (sourceCode: string, astTree: ESTree.Program): IGeneratorOutput {
const escodegenParams: escodegen.GenerateOptions = Object.assign(
{},
JavaScriptObfuscatorInternal.escodegenParams
);
if (options.sourceMap) {
if (this.options.sourceMap) {
escodegenParams.sourceMap = 'sourceMap';
escodegenParams.sourceContent = sourceCode;
}
escodegenParams.format = {
compact: options.compact
compact: this.options.compact
};
const generatorOutput: IGeneratorOutput = escodegen.generate(astTree, escodegenParams);
@@ -107,8 +106,7 @@ export class JavaScriptObfuscatorInternal {
).obfuscateAstTree(astTree);
// generate code
const generatorOutput: IGeneratorOutput = JavaScriptObfuscatorInternal
.generateCode(sourceCode, obfuscatedAstTree, this.options);
const generatorOutput: IGeneratorOutput = this.generateCode(sourceCode, obfuscatedAstTree);
return this.getObfuscationResult(generatorOutput);
}