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

90.47% Statements 19/21
33.33% Branches 1/3
100% Functions 1/1
90.47% Lines 19/21

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 211x 1x 1x 1x 1x 1x 1x 1x 1x 186x 186x     186x 186x 186x 186x 186x 186x 186x 1x
import {StatementNode} from "../../nodes";
import {CurrentScope} from "../_current_scope";
import {FormDefinition} from "../../types/form_definition";
import {ScopeType} from "../_scope_type";
import {FormName} from "../../2_statements/expressions";
import {StatementSyntax} from "../_statement_syntax";
 
export class Form implements StatementSyntax {
  public runSyntax(node: StatementNode, scope: CurrentScope, filename: string): void {
    const name = node.findDirectExpression(FormName)?.concatTokens();
    if (name === undefined) {
      throw new Error("Form, could not find name");
    }
    scope.push(ScopeType.Form, name, node.getFirstToken().getStart(), filename);
 
    const form = new FormDefinition(node, filename, scope);
    scope.addList(form.getUsingParameters());
    scope.addList(form.getChangingParameters());
    scope.addList(form.getTablesParameters());
  }
}