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

94.12% Statements 16/17
83.33% Branches 5/6
100% Functions 1/1
94.12% Lines 16/17

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   83x 83x 74x 63x     9x 9x     9x   7x 7x   4x        
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);
    Iif (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, resove the method definition above and pass, if possible, in case of dynamic pass void
      new MethodCallBody().runSyntax(body, scope, filename, new VoidType("CallTODO"));
    }
 
  }
}