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

94.44% Statements 17/18
66.67% Branches 4/6
100% Functions 1/1
94.44% Lines 17/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 19 20 21 22 23 24 25 26 27 28 29 30 31 32 331x     1x 1x 1x 1x     1x   8x 8x 8x   8x 2x     8x 8x 8x     7x 5x 5x            
import * as Expressions from "../../2_statements/expressions";
import {StatementNode} from "../../nodes";
import {CurrentScope} from "../_current_scope";
import {Source} from "../expressions/source";
import {FSTarget} from "../expressions/fstarget";
import {Dynamic} from "../expressions/dynamic";
import {VoidType} from "../../types/basic";
import {StatementSyntax} from "../_statement_syntax";
 
export class Assign implements StatementSyntax {
  public runSyntax(node: StatementNode, scope: CurrentScope, filename: string): void {
    const sources = node.findDirectExpressions(Expressions.Source);
    const firstSource = sources[0];
    const sourceType = firstSource ? new Source().runSyntax(firstSource, scope, filename) : new VoidType("DynamicAssign");
 
    for (const d of node.findAllExpressions(Expressions.Dynamic)) {
      new Dynamic().runSyntax(d, scope, filename);
    }
 
    const target = node.findDirectExpression(Expressions.FSTarget);
    Eif (target) {
      new FSTarget().runSyntax(target, scope, filename, sourceType);
    }
 
    for (const s of sources) {
      Eif (s === firstSource) {
        continue;
      }
      new Source().runSyntax(s, scope, filename);
    }
 
  }
}