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

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

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 241x 1x 1x 1x 1x 1x 89x 89x 89x 5x 5x 5x 84x 84x 89x 11x 89x 68x 73x 5x 5x 5x 89x 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);
      scope.getDDICReferences().addUsing(scope.getParentObj(), {object: found, token: token, filename: filename});
    }
  }
}