All files / src/abap/2_statements/statements call_function.ts

100% Statements 34/34
100% Branches 1/1
100% Functions 1/1
100% Lines 34/34

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 31 32 33 341x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x
import {IStatement} from "./_statement";
import {verNot, str, seq, opt, alt, per, altPrio} from "../combi";
import {FormName, Source, FunctionParameters, FunctionName, Destination, SimpleSource2, MethodSource} from "../expressions";
import {Version} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
export class CallFunction implements IStatement {
 
  public getMatcher(): IStatementRunnable {
 
    const starting = verNot(Version.Cloud, seq("STARTING NEW TASK", SimpleSource2));
    const update = verNot(Version.Cloud, str("IN UPDATE TASK"));
    const unit = seq("UNIT", Source);
    const background = verNot(Version.Cloud, seq("IN BACKGROUND", altPrio("TASK", unit)));
    const calling = seq("CALLING", MethodSource, "ON END OF TASK");
    const performing = seq("PERFORMING", FormName, "ON END OF TASK");
    const separate = str("AS SEPARATE UNIT");
    const keeping = str("KEEPING LOGICAL UNIT OF WORK");
 
    const options = per(starting, update, background, Destination, calling, performing, separate, keeping);
 
    const dynamic = seq("PARAMETER-TABLE", Source,
                        opt(seq("EXCEPTION-TABLE", Source)));
 
    const call = seq("CALL",
                     altPrio("FUNCTION", verNot(Version.Cloud, "CUSTOMER-FUNCTION")),
                     FunctionName,
                     opt(options),
                     alt(FunctionParameters, dynamic));
 
    return call;
  }
 
}