All files / src/abap abap_file.ts

100% Statements 64/64
100% Branches 11/11
100% Functions 7/7
100% Lines 64/64

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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 641x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8309x 8309x 8309x 8309x 8309x 8309x 8309x 8309x 8309x 8309x 8309x 8309x 1x 1x 461x 461x 1x 1x 2481x 2481x 1x 1x 8079x 8079x 1x 1x 26253x 26253x 1x 1x 3724x 1008x 3724x 2716x 2716x 35900x 35889x 35889x 2716x 2716x 2716x 3724x 1x 1x 24439x 24439x 1x 1x
import {Pragma} from "./1_lexer/tokens";
import {AbstractToken} from "./1_lexer/tokens/abstract_token";
import {AbstractFile} from "../files/_abstract_file";
import {IFile} from "../files/_ifile";
import {StructureNode, StatementNode} from "./nodes";
import {IABAPFileInformation} from "./4_file_information/_abap_file_information";
import {IABAPFile} from "./iabap_file";
 
export class ABAPFile extends AbstractFile implements IABAPFile {
  private readonly tokens: readonly AbstractToken[];
  private readonly statements: readonly StatementNode[];
  private readonly structure: StructureNode | undefined;
  private readonly file: IFile;
  private readonly info: IABAPFileInformation;
 
  public constructor(file: IFile,
                     tokens: readonly AbstractToken[],
                     statements: readonly StatementNode[],
                     structure: StructureNode | undefined,
                     info: IABAPFileInformation) {
 
    super(file.getFilename());
    this.file = file;
    this.tokens = tokens;
    this.statements = statements;
    this.structure = structure;
    this.info = info;
  }
 
  public getRaw(): string {
    return this.file.getRaw();
  }
 
  public getRawRows(): string[] {
    return this.file.getRawRows();
  }
 
  public getInfo(): IABAPFileInformation {
    return this.info;
  }
 
  public getStructure(): StructureNode | undefined {
    return this.structure;
  }
 
  public getTokens(withPragmas = true): readonly AbstractToken[] {
    if (withPragmas === true) {
      return this.tokens;
    } else {
      const tokens: AbstractToken[] = [];
      this.tokens.forEach((t) => {
        if (!(t instanceof Pragma)) {
          tokens.push(t);
        }
      });
      return tokens;
    }
  }
 
  public getStatements(): readonly StatementNode[] {
    return this.statements;
  }
 
}