All files / src/abap/2_statements/expressions _dynamic_access.ts

100% Statements 18/18
100% Branches 2/2
100% Functions 2/2
100% Lines 18/18

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 191x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 40x 40x 40x 1x 40x 40x 40x  
import {seq, tok, altPrio, ver} from "../combi";
import {Dash, InstanceArrow, ParenLeft, ParenRight, ParenRightW} from "../../1_lexer/tokens";
import {Constant} from "./constant";
import {FieldChain} from "./field_chain";
import {Release} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
 
const dynIdent = tok(ParenLeft);
const dynClose = altPrio(tok(ParenRight), tok(ParenRightW));
const dynInside = altPrio(new FieldChain(), Constant);
 
export function dynComp(...inside: IStatementRunnable[]): IStatementRunnable {
  return ver(Release.v757, seq(tok(Dash), dynIdent, dynInside, ...inside, dynClose));
}
 
export function dynAttr(): IStatementRunnable {
  return ver(Release.v757, seq(tok(InstanceArrow), dynIdent, dynInside, dynClose));
}