All files / src/abap/2_statements/expressions type_param.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 34 351x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import {seq, optPrio, alt, altPrio, Expression, opt, ver, AlsoIn} from "../combi";
import {Default, EntityAssociation, FieldChain, TypeName, TypeNameOrInfer, TypeStructure} from ".";
import {IStatementRunnable} from "../statement_runnable";
import {Release} from "../../../version";
import {derivedTypesAlt} from "./_derived_types";
 
export class TypeParam extends Expression {
  public getRunnable(): IStatementRunnable {
    const table = seq(altPrio("STANDARD", "HASHED", "INDEX", "SORTED", "ANY"),
                      "TABLE");
 
    const foo = seq(optPrio(seq(table, "OF")), optPrio("REF TO"));
 
    const typeLine = "LINE OF";
 
    const ret = seq(alt(foo, typeLine),
                    TypeNameOrInfer,
                    opt(Default));
 
    const like = seq("LIKE", opt("LINE OF"), FieldChain, optPrio(Default));
 
    const entity = alt(TypeName, EntityAssociation);
    const rapTable = ver(Release.v770,
                         seq("TYPE", "TABLE FOR", derivedTypesAlt(
                           ver(Release.v773, seq("ACTION IMPORT", entity), {also: AlsoIn.OpenABAP}),
                           ver(Release.v774, seq("READ LINK", entity), {also: AlsoIn.OpenABAP}),
                           ver(Release.v787, seq("EVENT", entity), {also: AlsoIn.OpenABAP}),
                         ), optPrio("VALUE IS INITIAL")),
                         {also: AlsoIn.OpenABAP});
 
    // Method parameters also allow the RAP table and response type forms.
    return altPrio(rapTable, TypeStructure, seq("TYPE", alt(table, ret)), like);
  }
}