All files / src/custom-nodes AbstractCustomNode.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58                1x                             3618x                       7236x             3612x             3618x                
import * as ESTree from 'estree';
 
import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
import { IOptions } from '../interfaces/IOptions';
import { TStatement } from '../types/TStatement';
 
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 {TStatement[]}
     */
    public getNode (): TStatement[] {
        return this.getNodeStructure();
    }
 
    /**
     * @param appendState
     */
    public setAppendState (appendState: AppendState): void {
        this.appendState = appendState;
    }
 
    /**
     * @returns {TStatement[]}
     */
    protected abstract getNodeStructure (): TStatement[];
}