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

100% Statements 26/26
100% Branches 2/2
100% Functions 1/1
100% Lines 26/26

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 271x 1x 1x 1x 1x 1x 1x 1x 1x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 2x 2x 2x 2x 2x 8x 1x  
import * as Expressions from "../../2_statements/expressions";
import {StatementNode} from "../../nodes";
import {StatementSyntax} from "../_statement_syntax";
import {SyntaxInput} from "../_syntax_input";
import {ReferenceType} from "../_reference";
import {SourceField} from "../expressions/source_field";
 
export class AtSelectionScreen implements StatementSyntax {
  public runSyntax(node: StatementNode, input: SyntaxInput): void {
    // "AT SELECTION-SCREEN ON <field>", "ON VALUE-REQUEST FOR <field>",
    // "ON HELP-REQUEST FOR <field>" and "ON END OF <field>" all reference
    // a parameter or select-option, register these as read references so
    // they are not reported as unused.
    const fields = [
      ...node.findDirectExpressions(Expressions.FieldSub),
      ...node.findDirectExpressions(Expressions.Field),
    ];
 
    for (const field of fields) {
      const token = field.getFirstToken();
      if (input.scope.findVariable(token.getStr()) !== undefined) {
        SourceField.runSyntax(field, input, ReferenceType.DataReadReference, false);
      }
    }
  }
}