All files / src/abap/5_syntax/expressions for.ts

100% Statements 17/17
75% Branches 3/4
100% Functions 1/1
100% Lines 17/17

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 35 36 371x     1x 1x 1x 1x   1x     9x 9x 9x 9x 9x     9x 7x     9x 3x     9x 2x                  
import * as Expressions from "../../2_statements/expressions";
import {ExpressionNode, StatementNode} from "../../nodes";
import {CurrentScope} from "../_current_scope";
import {InlineFieldDefinition} from "./inline_field_definition";
import {Source} from "./source";
import {InlineLoopDefinition} from "./inline_loop_definition";
import {ScopeType} from "../_scope_type";
 
export class For {
  public runSyntax(node: ExpressionNode | StatementNode, scope: CurrentScope, filename: string): void {
 
    const inlineLoop = node.findDirectExpressions(Expressions.InlineLoopDefinition);
    const inlineField = node.findAllExpressions(Expressions.InlineFieldDefinition);
    const addScope = inlineLoop.length > 0 || inlineField.length > 0;
    Eif (addScope) {
      scope.push(ScopeType.For, "FOR", node.getFirstToken().getStart(), filename);
    }
 
    for (const s of inlineLoop) {
      new InlineLoopDefinition().runSyntax(s, scope, filename);
    }
 
    for (const f of inlineField) {
      new InlineFieldDefinition().runSyntax(f, scope, filename);
    }
 
    for (const s of node.findDirectExpressions(Expressions.Source)) {
      new Source().runSyntax(s, scope, filename);
    }
 
    /*
    if (addScope) {
      scope.pop(node.getLastToken().getEnd());
    }
    */
  }
}