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

92.85% Statements 26/28
80% Branches 4/5
100% Functions 1/1
92.85% Lines 26/28

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