AbstractControlFlowReplacer.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { injectable, inject } from 'inversify';
  2. import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
  3. import * as ESTree from 'estree';
  4. import { IControlFlowReplacer } from '../../../interfaces/node-transformers/IControlFlowReplacer';
  5. import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
  6. import { IOptions } from '../../../interfaces/options/IOptions';
  7. import { IStorage } from '../../../interfaces/storages/IStorage';
  8. @injectable()
  9. export abstract class AbstractControlFlowReplacer implements IControlFlowReplacer {
  10. /**
  11. * @type {IOptions}
  12. */
  13. protected readonly options: IOptions;
  14. /**
  15. * @param options
  16. */
  17. constructor (
  18. @inject(ServiceIdentifiers.IOptions) options: IOptions
  19. ) {
  20. this.options = options;
  21. }
  22. /**
  23. * @param node
  24. * @param parentNode
  25. * @param controlFlowStorage
  26. * @returns {ESTree.Node}
  27. */
  28. public abstract replace (
  29. node: ESTree.Node,
  30. parentNode: ESTree.Node,
  31. controlFlowStorage: IStorage <ICustomNode>
  32. ): ESTree.Node;
  33. }