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

94.12% Statements 16/17
87.5% Branches 7/8
100% Functions 1/1
94.12% Lines 16/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 301x     1x   1x     4x 4x 2x 2x 2x 1x   1x     3x 3x 1x 1x 1x     1x        
import * as Expressions from "../../2_statements/expressions";
import {ExpressionNode} from "../../nodes";
import {CurrentScope} from "../_current_scope";
import {ReferenceType} from "../_reference";
 
export class FieldLength {
  public runSyntax(node: ExpressionNode, scope: CurrentScope, filename: string): void {
 
    const field = node.findDirectExpression(Expressions.SourceField);
    if (field) {
      const token = field.getFirstToken();
      const found = scope.findVariable(token.getStr());
      if (found === undefined) {
        throw new Error("\"" + field.getFirstToken().getStr() + "\" not found, FieldLength");
      }
      scope.addReference(token, found, ReferenceType.DataReadReference, filename);
    }
 
    const symbol = node.findDirectExpression(Expressions.SourceFieldSymbol);
    if (symbol) {
      const token = symbol.getFirstToken();
      const found = scope.findVariable(token.getStr());
      Iif (found === undefined) {
        throw new Error("\"" + symbol.getFirstToken().getStr() + "\" not found, FieldLength");
      }
      scope.addReference(token, found, ReferenceType.DataReadReference, filename);
    }
 
  }
}