All files / src/abap/5_syntax/statements call.ts

93.55% Statements 29/31
83.33% Branches 5/6
100% Functions 1/1
93.55% Lines 29/31

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 311x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 93x 93x 84x 84x 84x 9x 9x 93x     9x 9x 9x 93x 4x 4x 4x 93x 93x 1x
import * as Expressions from "../../2_statements/expressions";
import {StatementNode} from "../../nodes";
import {CurrentScope} from "../_current_scope";
import {MethodCallChain} from "../expressions/method_call_chain";
import {MethodSource} from "../expressions/method_source";
import {MethodCallBody} from "../expressions/method_call_body";
import {VoidType} from "../../types/basic/void_type";
import {StatementSyntax} from "../_statement_syntax";
 
export class Call implements StatementSyntax {
  public runSyntax(node: StatementNode, scope: CurrentScope, filename: string): void {
    const chain = node.findDirectExpression(Expressions.MethodCallChain);
    if (chain) {
      new MethodCallChain().runSyntax(chain, scope, filename);
      return;
    }
 
    const methodSource = node.findDirectExpression(Expressions.MethodSource);
    if (methodSource === undefined) {
      throw new Error("Call, child MethodSource not found");
    }
    new MethodSource().runSyntax(methodSource, scope, filename);
 
    const body = node.findDirectExpression(Expressions.MethodCallBody);
    if (body) {
      // todo, resolve the method definition above and pass, if possible, in case of dynamic pass void
      new MethodCallBody().runSyntax(body, scope, filename, new VoidType("CallTODO"));
    }
 
  }
}