All files / src/abap/nodes _abstract_node.ts

100% Statements 35/35
100% Branches 6/6
100% Functions 6/6
100% Lines 35/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 351x 1x 1x 1x 1x 1x 1x 211331x 211331x 1x 1x 1x 1x 1x 1x 23354x 23354x 1x 1x 161595x 161595x 1x 1x 752031x 752031x 1x 1x 444x 444x 1x 1x 21610x 21610x 1x 1x
import {INode} from "./_inode";
import {Token} from "../1_lexer/tokens/_token";
 
export abstract class AbstractNode<T extends INode> implements INode {
  protected children: T[];
 
  public constructor() {
    this.children = [];
  }
 
  public abstract get(): any;
  public abstract getFirstToken(): Token;
  public abstract getLastToken(): Token;
 
  public addChild(n: T) {
    this.children.push(n);
  }
 
  public setChildren(children: T[]) {
    this.children = children;
  }
 
  public getChildren(): readonly T[] {
    return this.children;
  }
 
  public getFirstChild(): T | undefined {
    return this.children[0];
  }
 
  public getLastChild(): T | undefined {
    return this.children[this.children.length - 1];
  }
 
}