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

100% Statements 23/23
100% Branches 8/8
100% Functions 1/1
100% Lines 23/23

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 231x 1x 1x 1x 1x 1x 56x 56x 56x 3x 3x 3x 53x 53x 56x 6x 56x 44x 47x 3x 3x 56x 1x
import {ExpressionNode} from "../../nodes";
import {CurrentScope} from "../_current_scope";
import {ReferenceType} from "../_reference";
 
export class DatabaseTable {
  public runSyntax(node: ExpressionNode, scope: CurrentScope, filename: string): void {
    const token = node.getFirstToken();
    const name = token.getStr();
    if (name === "(") {
      // dynamic
      return;
    }
 
    const found = scope.getDDIC().lookupTableOrView2(name);
    if (found === undefined && scope.getDDIC().inErrorNamespace(name) === true) {
      throw new Error("Database table or view \"" + name + "\" not found");
    } else if (found === undefined) {
      scope.addReference(token, undefined, ReferenceType.TableVoidReference, filename);
    } else {
      scope.addReference(token, found.getIdentifier(), ReferenceType.TableReference, filename);
    }
  }
}