All files / src/abap/5_syntax/expressions sql_for_all_entries.ts

86.66% Statements 26/30
80% Branches 4/5
100% Functions 1/1
86.66% Lines 26/30

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 301x 1x 1x 1x 1x 1x 1x 1x 1x 9x 9x 9x 9x 9x 9x 9x 2x 2x 9x         7x 7x 7x 7x 9x 1x 1x
import * as Expressions from "../../2_statements/expressions";
import {ExpressionNode} from "../../nodes";
import {Source} from "./source";
import {VoidType, TableType} from "../../types/basic";
import {SyntaxInput, syntaxIssue} from "../_syntax_input";
 
export class SQLForAllEntries {
 
  public runSyntax(node: ExpressionNode, input: SyntaxInput): void {
    let s = node.findFirstExpression(Expressions.Source);
    if (s === undefined) {
      s = node.findFirstExpression(Expressions.SimpleSource3);
    }
    if (s) {
      const type = new Source().runSyntax(s, input);
      if (type instanceof VoidType) {
        return;
      }
      if (!(type instanceof TableType)) {
        const message = "FAE parameter must be table type";
        input.issues.push(syntaxIssue(input, node.getFirstToken(), message));
        return;
      }
 
      const name = s.concatTokens().replace("[]", "");
      input.scope.setAllowHeaderUse(name);
    }
  }
 
}