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

100% Statements 36/36
100% Branches 7/7
100% Functions 1/1
100% Lines 36/36

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 361x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 2x 1x 1x 5x 7x 2x 2x 5x 5x 5x 5x 5x 1x 1x
import * as Expressions from "../../2_statements/expressions";
import {ExpressionNode, StatementNode} from "../../nodes";
import {TableType, UnknownType, VoidType} from "../../types/basic";
import {SyntaxInput, syntaxIssue} from "../_syntax_input";
import {SQLSource} from "./sql_source";
 
export class SQLIn {
 
  public runSyntax(node: ExpressionNode | StatementNode, input: SyntaxInput): void {
 
    if (node.getChildren().length === 2) {
      const insource = node.findFirstExpression(Expressions.SQLSource);
      if (insource) {
        const intype = new SQLSource().runSyntax(insource, input);
        if (intype &&
            !(intype instanceof VoidType) &&
            !(intype instanceof UnknownType) &&
            !(intype instanceof TableType)) {
          const message = "IN, not a table";
          input.issues.push(syntaxIssue(input, node.getFirstToken(), message));
          return;
        }
      }
      return;
    }
 
    for (const s of node.findDirectExpressions(Expressions.SQLSource)) {
      new SQLSource().runSyntax(s, input);
    }
    for (const s of node.findDirectExpressions(Expressions.SQLSourceNoSpace)) {
      new SQLSource().runSyntax(s, input);
    }
 
  }
 
}