Просмотр исходного кода

Extracted string array index type logic to a StringArrayIndexNode classes

sanex 4 лет назад
Родитель
Сommit
381582f6f3

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/index.browser.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/index.cli.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/index.js


+ 2 - 0
src/container/ServiceIdentifiers.ts

@@ -13,6 +13,7 @@ export enum ServiceIdentifiers {
     Factory__IObjectExpressionKeysTransformerCustomNode = 'Factory<IObjectExpressionKeysTransformerCustomNode>',
     Factory__IObjectExpressionExtractor = 'Factory<IObjectExpressionExtractor>',
     Factory__IStringArrayCustomNode = 'Factory<IStringArrayCustomNode>',
+    Factory__IStringArrayIndexNode = 'Factory<IStringArrayIndexNode>',
     Factory__TControlFlowStorage = 'Factory<TControlFlowStorage>',
     IArrayUtils = 'IArrayUtils',
     ICalleeDataExtractor = 'ICalleeDataExtractor',
@@ -50,6 +51,7 @@ export enum ServiceIdentifiers {
     IScopeIdentifiersTraverser = 'IScopeIdentifiersTraverser',
     ISourceCode = 'ISourceCode',
     IScopeAnalyzer = 'IScopeAnalyzer',
+    IStringArrayIndexNode = 'IStringArrayIndexNode',
     IStringArrayScopeCallsWrapperLexicalScopeDataStorage = 'IStringArrayScopeCallsWrapperLexicalScopeDataStorage',
     IStringArrayScopeCallsWrapperNamesDataStorage = 'IStringArrayScopeCallsWrapperNamesDataStorage',
     IStringArrayStorage = 'IStringArrayStorage',

+ 22 - 1
src/container/modules/custom-nodes/CustomNodesModule.ts

@@ -3,13 +3,13 @@ import { ContainerModule, interfaces } from 'inversify';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
+import { IStringArrayIndexNode } from '../../../interfaces/custom-nodes/string-array-nodes/IStringArrayIndexNode';
 
 import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCustomNode';
 import { DeadCodeInjectionCustomNode } from '../../../enums/custom-nodes/DeadCodeInjectionCustomNode';
 import { ObjectExpressionKeysTransformerCustomNode } from '../../../enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode';
 import { StringArrayCustomNode } from '../../../enums/custom-nodes/StringArrayCustomNode';
 
-import { ObjectExpressionVariableDeclarationHostNode } from '../../../custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode';
 import { BinaryExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode';
 import { BlockStatementControlFlowFlatteningNode } from '../../../custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode';
 import { BlockStatementDeadCodeInjectionNode } from '../../../custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode';
@@ -18,7 +18,11 @@ import { CallExpressionFunctionNode } from '../../../custom-nodes/control-flow-f
 import { ControlFlowStorageNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode';
 import { ExpressionWithOperatorControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode';
 import { LogicalExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode';
+import { ObjectExpressionVariableDeclarationHostNode } from '../../../custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode';
 import { StringArrayCallNode } from '../../../custom-nodes/string-array-nodes/StringArrayCallNode';
+import { StringArrayHexadecimalNumberIndexNode } from '../../../custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumberIndexNode';
+import { StringArrayHexadecimalNumericStringIndexNode } from '../../../custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumericStringIndexNode';
+import { StringArrayIndexNode } from '../../../enums/custom-nodes/string-array-index-nodes/StringArrayIndexNode';
 import { StringArrayScopeCallsWrapperFunctionNode } from '../../../custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperFunctionNode';
 import { StringArrayScopeCallsWrapperVariableNode } from '../../../custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperVariableNode';
 import { StringLiteralControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode';
@@ -85,6 +89,17 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
         .toConstructor(StringArrayScopeCallsWrapperVariableNode)
         .whenTargetNamed(StringArrayCustomNode.StringArrayScopeCallsWrapperVariableNode);
 
+    // string array index nodes
+    bind<IStringArrayIndexNode>(ServiceIdentifiers.IStringArrayIndexNode)
+        .to(StringArrayHexadecimalNumberIndexNode)
+        .inSingletonScope()
+        .whenTargetNamed(StringArrayIndexNode.StringArrayHexadecimalNumberIndexNode);
+
+    bind<IStringArrayIndexNode>(ServiceIdentifiers.IStringArrayIndexNode)
+        .to(StringArrayHexadecimalNumericStringIndexNode)
+        .inSingletonScope()
+        .whenTargetNamed(StringArrayIndexNode.StringArrayHexadecimalNumericStringIndexNode);
+
     // control flow customNode constructor factory
     bind<ICustomNode>(ServiceIdentifiers.Factory__IControlFlowCustomNode)
         .toFactory<ICustomNode>(InversifyContainerFacade
@@ -124,8 +139,14 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
             .getConstructorFactory<StringArrayCustomNode, ICustomNode>(
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
+                ServiceIdentifiers.Factory__IStringArrayIndexNode,
                 ServiceIdentifiers.ICustomCodeHelperFormatter,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IOptions
             ));
+
+    // string array index node factory
+    bind<IStringArrayIndexNode>(ServiceIdentifiers.Factory__IStringArrayIndexNode)
+        .toFactory<IStringArrayIndexNode>(InversifyContainerFacade
+            .getCacheFactory<StringArrayIndexNode, IStringArrayIndexNode>(ServiceIdentifiers.IStringArrayIndexNode));
 });

+ 27 - 32
src/custom-nodes/string-array-nodes/AbstractStringArrayCallNode.ts

@@ -5,23 +5,38 @@ import * as ESTree from 'estree';
 
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStringArrayIndexesType } from '../../types/options/TStringArrayIndexesType';
+import { TStringArrayIndexNodeFactory } from '../../types/container/custom-nodes/string-array-index-nodes/TStringArrayIndexNodeFactory';
 
 import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 import { StringArrayIndexesType } from '../../enums/node-transformers/string-array-transformers/StringArrayIndexesType';
+import { StringArrayIndexNode } from '../../enums/custom-nodes/string-array-index-nodes/StringArrayIndexNode';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
 import { NodeFactory } from '../../node/NodeFactory';
 import { NodeMetadata } from '../../node/NodeMetadata';
 import { NodeUtils } from '../../node/NodeUtils';
-import { NumberUtils } from '../../utils/NumberUtils';
 
 @injectable()
 export abstract class AbstractStringArrayCallNode extends AbstractCustomNode {
+    /**
+     * @type {Map<TStringArrayIndexesType, StringArrayIndexNode>}
+     */
+    private static readonly stringArrayIndexNodesMap: Map<TStringArrayIndexesType, StringArrayIndexNode> = new Map([
+        [StringArrayIndexesType.HexadecimalNumber, StringArrayIndexNode.StringArrayHexadecimalNumberIndexNode],
+        [StringArrayIndexesType.HexadecimalNumericString, StringArrayIndexNode.StringArrayHexadecimalNumericStringIndexNode]
+    ]);
+
+    /**
+     * @type {TStringArrayIndexNodeFactory}
+     */
+    private readonly stringArrayIndexNodeFactory: TStringArrayIndexNodeFactory;
+
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {TStringArrayIndexNodeFactory} stringArrayIndexNodeFactory
      * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
@@ -29,6 +44,8 @@ export abstract class AbstractStringArrayCallNode extends AbstractCustomNode {
     protected constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.Factory__IStringArrayIndexNode)
+            stringArrayIndexNodeFactory: TStringArrayIndexNodeFactory,
         @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
@@ -39,32 +56,30 @@ export abstract class AbstractStringArrayCallNode extends AbstractCustomNode {
             randomGenerator,
             options
         );
+
+        this.stringArrayIndexNodeFactory = stringArrayIndexNodeFactory;
     }
 
     /**
      * @param {number} index
      * @returns {Expression}
      */
-    protected getStringArrayCallIndexNode (index: number): ESTree.Expression {
+    protected getStringArrayIndexNode (index: number): ESTree.Expression {
         const isPositive: boolean = index >= 0;
         const normalizedIndex: number = Math.abs(index);
 
         const stringArrayCallsIndexType: TStringArrayIndexesType = this.randomGenerator
             .getRandomGenerator()
             .pickone(this.options.stringArrayIndexesType);
-        let stringArrayCallIndexNode: ESTree.Expression;
-
-        switch (stringArrayCallsIndexType) {
-            case StringArrayIndexesType.HexadecimalNumber:
-                stringArrayCallIndexNode = this.getHexadecimalNumberCallIndexNode(normalizedIndex);
-                break;
+        const stringArrayIndexNodeName: StringArrayIndexNode | null = AbstractStringArrayCallNode.stringArrayIndexNodesMap.get(stringArrayCallsIndexType) ?? null;
 
-            case StringArrayIndexesType.HexadecimalNumericString:
-            default:
-                stringArrayCallIndexNode = this.getHexadecimalNumericStringCallIndexNode(normalizedIndex);
-                break;
+        if (!stringArrayIndexNodeName) {
+            throw new Error('Invalid string array index node name');
         }
 
+        const stringArrayCallIndexNode: ESTree.Expression = this.stringArrayIndexNodeFactory(stringArrayIndexNodeName)
+            .getNode(normalizedIndex);
+
         NodeMetadata.set(stringArrayCallIndexNode, { replacedLiteral: true });
 
         const hexadecimalNode: ESTree.Expression = isPositive
@@ -90,24 +105,4 @@ export abstract class AbstractStringArrayCallNode extends AbstractCustomNode {
 
         return rc4KeyLiteralNode;
     }
-
-    /**
-     * @param {number} index
-     * @returns {Expression}
-     */
-    private getHexadecimalNumberCallIndexNode (index: number): ESTree.Expression {
-        const hexadecimalIndex: string = NumberUtils.toHex(index);
-
-        return NodeFactory.literalNode(index, hexadecimalIndex);
-    }
-
-    /**
-     * @param {number} index
-     * @returns {Expression}
-     */
-    private getHexadecimalNumericStringCallIndexNode (index: number): ESTree.Expression {
-        const hexadecimalIndex: string = NumberUtils.toHex(index);
-
-        return NodeFactory.literalNode(hexadecimalIndex);
-    }
 }

+ 6 - 1
src/custom-nodes/string-array-nodes/StringArrayCallNode.ts

@@ -5,6 +5,7 @@ import * as ESTree from 'estree';
 
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
+import { TStringArrayIndexNodeFactory } from '../../types/container/custom-nodes/string-array-index-nodes/TStringArrayIndexNodeFactory';
 
 import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
@@ -44,6 +45,7 @@ export class StringArrayCallNode extends AbstractStringArrayCallNode {
 
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {TStringArrayIndexNodeFactory} stringArrayIndexNodeFactory
      * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
@@ -51,12 +53,15 @@ export class StringArrayCallNode extends AbstractStringArrayCallNode {
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.Factory__IStringArrayIndexNode)
+            stringArrayIndexNodeFactory: TStringArrayIndexNodeFactory,
         @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(
             identifierNamesGeneratorFactory,
+            stringArrayIndexNodeFactory,
             customCodeHelperFormatter,
             randomGenerator,
             options
@@ -86,7 +91,7 @@ export class StringArrayCallNode extends AbstractStringArrayCallNode {
      */
     protected getNodeStructure (): TStatement[] {
         const callExpressionArgs: ESTree.Expression[] = [
-            this.getStringArrayCallIndexNode(this.indexShiftAmount + this.index)
+            this.getStringArrayIndexNode(this.indexShiftAmount + this.index)
         ];
 
         if (this.decodeKey) {

+ 6 - 1
src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperFunctionNode.ts

@@ -5,6 +5,7 @@ import * as ESTree from 'estree';
 
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
+import { TStringArrayIndexNodeFactory } from '../../types/container/custom-nodes/string-array-index-nodes/TStringArrayIndexNodeFactory';
 
 import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
@@ -39,6 +40,7 @@ export class StringArrayScopeCallsWrapperFunctionNode extends AbstractStringArra
 
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {TStringArrayIndexNodeFactory} stringArrayIndexNodeFactory
      * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
@@ -46,12 +48,15 @@ export class StringArrayScopeCallsWrapperFunctionNode extends AbstractStringArra
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.Factory__IStringArrayIndexNode)
+            stringArrayIndexNodeFactory: TStringArrayIndexNodeFactory,
         @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
         super(
             identifierNamesGeneratorFactory,
+            stringArrayIndexNodeFactory,
             customCodeHelperFormatter,
             randomGenerator,
             options
@@ -101,7 +106,7 @@ export class StringArrayScopeCallsWrapperFunctionNode extends AbstractStringArra
                             NodeFactory.binaryExpressionNode(
                                 '-',
                                 firstCallArgumentIdentifierNode,
-                                this.getStringArrayCallIndexNode(this.shiftedIndex)
+                                this.getStringArrayIndexNode(this.shiftedIndex)
                             ),
                             secondCallArgumentIdentifierNode
                         ]

+ 6 - 1
src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperVariableNode.ts

@@ -3,6 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
+import { TStringArrayIndexNodeFactory } from '../../types/container/custom-nodes/string-array-index-nodes/TStringArrayIndexNodeFactory';
 
 import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
@@ -31,6 +32,7 @@ export class StringArrayScopeCallsWrapperVariableNode extends AbstractStringArra
 
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {TStringArrayIndexNodeFactory} stringArrayIndexNodeFactory
      * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
@@ -38,12 +40,15 @@ export class StringArrayScopeCallsWrapperVariableNode extends AbstractStringArra
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.Factory__IStringArrayIndexNode)
+            stringArrayIndexNodeFactory: TStringArrayIndexNodeFactory,
         @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
-        @inject(ServiceIdentifiers.IOptions) options: IOptions
+        @inject(ServiceIdentifiers.IOptions) options: IOptions,
     ) {
         super(
             identifierNamesGeneratorFactory,
+            stringArrayIndexNodeFactory,
             customCodeHelperFormatter,
             randomGenerator,
             options

+ 40 - 0
src/custom-nodes/string-array-nodes/string-array-index-nodes/AbstractStringArrayIndexNode.ts

@@ -0,0 +1,40 @@
+import { inject, injectable } from 'inversify';
+
+import * as ESTree from 'estree';
+
+import { IOptions } from '../../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+import { IStringArrayIndexNode } from '../../../interfaces/custom-nodes/string-array-nodes/IStringArrayIndexNode';
+
+import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
+
+@injectable()
+export abstract class AbstractStringArrayIndexNode implements IStringArrayIndexNode {
+    /**
+     * @type {IOptions}
+     */
+    protected readonly options: IOptions;
+
+    /**
+     * @type {IRandomGenerator}
+     */
+    protected readonly randomGenerator: IRandomGenerator;
+
+    /**
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    protected constructor (
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        this.randomGenerator = randomGenerator;
+        this.options = options;
+    }
+
+    /**
+     * @param {number} index
+     * @returns {Expression}
+     */
+    public abstract getNode (index: number): ESTree.Expression;
+}

+ 36 - 0
src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumberIndexNode.ts

@@ -0,0 +1,36 @@
+import { inject, injectable } from 'inversify';
+
+import * as ESTree from 'estree';
+
+import { IOptions } from '../../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+
+import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
+
+import { AbstractStringArrayIndexNode } from './AbstractStringArrayIndexNode';
+import { NodeFactory } from '../../../node/NodeFactory';
+import { NumberUtils } from '../../../utils/NumberUtils';
+
+@injectable()
+export class StringArrayHexadecimalNumberIndexNode extends AbstractStringArrayIndexNode {
+    /**
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    public constructor (
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(randomGenerator, options);
+    }
+
+    /**
+     * @param {number} index
+     * @returns {Expression}
+     */
+    public getNode (index: number): ESTree.Expression {
+        const hexadecimalIndex: string = NumberUtils.toHex(index);
+
+        return NodeFactory.literalNode(index, hexadecimalIndex);
+    }
+}

+ 36 - 0
src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumericStringIndexNode.ts

@@ -0,0 +1,36 @@
+import { inject, injectable } from 'inversify';
+
+import * as ESTree from 'estree';
+
+import { IOptions } from '../../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+
+import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
+
+import { AbstractStringArrayIndexNode } from './AbstractStringArrayIndexNode';
+import { NodeFactory } from '../../../node/NodeFactory';
+import { NumberUtils } from '../../../utils/NumberUtils';
+
+@injectable()
+export class StringArrayHexadecimalNumericStringIndexNode extends AbstractStringArrayIndexNode {
+    /**
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    public constructor (
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(randomGenerator, options);
+    }
+
+    /**
+     * @param {number} index
+     * @returns {Expression}
+     */
+    public getNode (index: number): ESTree.Expression {
+        const hexadecimalIndex: string = NumberUtils.toHex(index);
+
+        return NodeFactory.literalNode(hexadecimalIndex);
+    }
+}

+ 4 - 0
src/enums/custom-nodes/string-array-index-nodes/StringArrayIndexNode.ts

@@ -0,0 +1,4 @@
+export enum StringArrayIndexNode {
+    StringArrayHexadecimalNumberIndexNode = 'StringArrayHexadecimalNumberIndexNode',
+    StringArrayHexadecimalNumericStringIndexNode = 'StringArrayHexadecimalNumericStringIndexNode'
+}

+ 5 - 0
src/interfaces/custom-nodes/string-array-nodes/IStringArrayIndexNode.ts

@@ -0,0 +1,5 @@
+import * as ESTree from 'estree';
+
+export interface IStringArrayIndexNode {
+    getNode: (index: number) => ESTree.Expression;
+}

+ 2 - 2
src/node-transformers/string-array-transformers/StringArrayScopeCallsWrapperTransformer.ts

@@ -153,7 +153,7 @@ export class StringArrayScopeCallsWrapperTransformer extends AbstractNodeTransfo
                 const [
                     upperStringArrayCallsWrapperName,
                     upperStringArrayCallsWrapperShiftedIndex,
-                ] = this.getUpperStringArrayCallsWrapperName(
+                ] = this.getUpperStringArrayCallsWrapperData(
                     stringArrayScopeCallsWrapperNamesData,
                     stringArrayScopeCallsWrapperNamesLexicalScopeData,
                 );
@@ -197,7 +197,7 @@ export class StringArrayScopeCallsWrapperTransformer extends AbstractNodeTransfo
      * @param {IStringArrayScopeCallsWrapperLexicalScopeData} stringArrayScopeCallsWrapperNamesLexicalScopeData
      * @returns {[name: string, index: number]}
      */
-    private getUpperStringArrayCallsWrapperName (
+    private getUpperStringArrayCallsWrapperData (
         stringArrayScopeCallsWrapperNamesData: IStringArrayScopeCallsWrapperNamesData,
         stringArrayScopeCallsWrapperNamesLexicalScopeData: IStringArrayScopeCallsWrapperLexicalScopeData
     ): [name: string, index: number] {

+ 5 - 0
src/types/container/custom-nodes/string-array-index-nodes/TStringArrayIndexNodeFactory.ts

@@ -0,0 +1,5 @@
+import { IStringArrayIndexNode } from '../../../../interfaces/custom-nodes/string-array-nodes/IStringArrayIndexNode';
+
+import { StringArrayIndexNode } from '../../../../enums/custom-nodes/string-array-index-nodes/StringArrayIndexNode';
+
+export type TStringArrayIndexNodeFactory = (stringArrayIndexNodeName: StringArrayIndexNode) => IStringArrayIndexNode;

+ 1 - 0
test/dev/dev.ts

@@ -36,6 +36,7 @@ import { StringArrayIndexesType } from '../../src/enums/node-transformers/string
             shuffleStringArray: true,
             stringArray: true,
             stringArrayIndexesType: [
+                StringArrayIndexesType.HexadecimalNumericString,
                 StringArrayIndexesType.HexadecimalNumber
             ],
             stringArrayIndexShift: true,

Некоторые файлы не были показаны из-за большого количества измененных файлов