12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import * as ESTree from 'estree';
- import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
- import { IOptions } from '../interfaces/IOptions';
- import { AppendState } from '../enums/AppendState';
- export abstract class AbstractCustomNode implements ICustomNode {
- /**
- * @type {AppendState}
- */
- protected abstract appendState: AppendState;
- /**
- * @type {IOptions}
- */
- protected options: IOptions;
- /**
- * @param options
- */
- constructor (options: IOptions) {
- this.options = options;
- }
- /**
- * @param astTree
- */
- public abstract appendNode (astTree: ESTree.Node): void;
- /**
- * @returns {AppendState}
- */
- public getAppendState (): AppendState {
- return this.appendState;
- }
- /**
- * @returns {ESTree.Node}
- */
- public getNode (): ESTree.Node {
- return this.getNodeStructure();
- }
- /**
- * @returns {ESTree.Node}
- */
- protected abstract getNodeStructure (): ESTree.Node;
- }
|