123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { inject, injectable, } from 'inversify';
- import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
- import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
- import { TStatement } from '../../types/node/TStatement';
- import { IOptions } from '../../interfaces/options/IOptions';
- import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
- import { initializable } from '../../decorators/Initializable';
- import { AbstractCustomNode } from '../AbstractCustomNode';
- import { NodeFactory } from '../../node/NodeFactory';
- @injectable()
- export class StringLiteralNode extends AbstractCustomNode {
- /**
- * @type {string}
- */
- @initializable()
- private literalValue!: string;
- /**
- * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
- * @param {IRandomGenerator} randomGenerator
- * @param {IOptions} options
- */
- constructor (
- @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
- identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
- @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
- @inject(ServiceIdentifiers.IOptions) options: IOptions
- ) {
- super(identifierNamesGeneratorFactory, randomGenerator, options);
- }
- /**
- * @param {string} literalValue
- */
- public initialize (literalValue: string): void {
- this.literalValue = literalValue;
- }
- /**
- * @returns {TStatement[]}
- */
- protected getNodeStructure (): TStatement[] {
- const structure: TStatement = NodeFactory.expressionStatementNode(
- NodeFactory.literalNode(this.literalValue)
- );
- return [structure];
- }
- }
|