All files / src/abap/5_syntax/statements controls.ts

100% Statements 47/47
83.33% Branches 5/6
100% Functions 1/1
100% Lines 47/47

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 471x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 1x 1x 1x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 1x
import * as Expressions from "../../2_statements/expressions";
import {StatementNode} from "../../nodes";
import {CurrentScope} from "../_current_scope";
import {TypedIdentifier} from "../../types/_typed_identifier";
import {StructureType, CharacterType, IntegerType, TableType, TableKeyType} from "../../types/basic";
import {StatementSyntax} from "../_statement_syntax";
 
export class Controls implements StatementSyntax {
  public runSyntax(node: StatementNode, scope: CurrentScope, filename: string): void {
 
    const name = node.findDirectExpression(Expressions.NamespaceSimpleName);
    const token = name?.getFirstToken();
 
    if (node.findDirectTokenByText("TABSTRIP") && token) {
      const type = new StructureType([{name: "ACTIVETAB", type: new CharacterType(132)}]);
      const id = new TypedIdentifier(token, filename, type);
      scope.addIdentifier(id);
    }
 
    if (node.findDirectTokenByText("TABLEVIEW") && token) {
      const cols = new StructureType([
        {name: "SCREEN", type: new CharacterType(1)}, // todo
        {name: "INDEX", type: IntegerType.get()},
        {name: "SELECTED", type: new CharacterType(1)},
        {name: "VISLENGTH", type: IntegerType.get()},
        {name: "INVISIBLE", type: new CharacterType(1)},
      ]);
      const type = new StructureType([
        {name: "FIXED_COLS", type: new CharacterType(132)},
        {name: "LINES", type: IntegerType.get()},
        {name: "TOP_LINE", type: IntegerType.get()},
        {name: "CURRENT_LINE", type: IntegerType.get()},
        {name: "LEFT_COL", type: IntegerType.get()},
        {name: "LINE_SEL_MODE", type: new CharacterType(1)},
        {name: "COL_SEL_MODE", type: new CharacterType(1)},
        {name: "LINE_SELECTOR", type: new CharacterType(1)},
        {name: "H_GRID", type: new CharacterType(1)},
        {name: "V_GRID", type: new CharacterType(1)},
        {name: "COLS", type: new TableType(cols, {withHeader: false, keyType: TableKeyType.default})},
        {name: "INVISIBLE", type: new CharacterType(1)},
      ]);
      const id = new TypedIdentifier(token, filename, type);
      scope.addIdentifier(id);
    }
 
  }
}