mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
replaced let on const, added readonly keywords
This commit is contained in:
@@ -15,7 +15,7 @@ export class NodeUtils {
|
||||
/**
|
||||
* @type {string[]}
|
||||
*/
|
||||
private static nodesWithBlockScope: string[] = [
|
||||
private static readonly nodesWithBlockScope: string[] = [
|
||||
NodeType.ArrowFunctionExpression,
|
||||
NodeType.FunctionDeclaration,
|
||||
NodeType.FunctionExpression,
|
||||
@@ -42,7 +42,7 @@ export class NodeUtils {
|
||||
* @returns {TStatement[]}
|
||||
*/
|
||||
public static convertCodeToStructure (code: string): TStatement[] {
|
||||
let structure: ESTree.Program = esprima.parse(code);
|
||||
const structure: ESTree.Program = esprima.parse(code);
|
||||
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(structure);
|
||||
NodeUtils.parentize(structure);
|
||||
@@ -73,7 +73,7 @@ export class NodeUtils {
|
||||
* @returns {ESTree.Node}
|
||||
*/
|
||||
public static getBlockScopeOfNode (node: ESTree.Node, depth: number = 0): TNodeWithBlockStatement {
|
||||
let parentNode: ESTree.Node | undefined = node.parentNode;
|
||||
const parentNode: ESTree.Node | undefined = node.parentNode;
|
||||
|
||||
if (!parentNode) {
|
||||
throw new ReferenceError('`parentNode` property of given node is `undefined`');
|
||||
@@ -106,7 +106,7 @@ export class NodeUtils {
|
||||
* @returns {number}
|
||||
*/
|
||||
public static getNodeBlockScopeDepth (node: ESTree.Node, depth: number = 0): number {
|
||||
let parentNode: ESTree.Node | undefined = node.parentNode;
|
||||
const parentNode: ESTree.Node | undefined = node.parentNode;
|
||||
|
||||
if (!parentNode) {
|
||||
throw new ReferenceError('`parentNode` property of given node is `undefined`');
|
||||
|
||||
Reference in New Issue
Block a user