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

100% Statements 19/19
100% Branches 3/3
100% Functions 1/1
100% Lines 19/19

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 191x 1x 1x 1x 1x 1x 1x 1x 80x 80x 80x 2x 2x 2x 2x 78x 78x 78x 1x
import {ExpressionNode} from "../../nodes";
import {VoidType} from "../../types/basic";
import {AbstractType} from "../../types/basic/_abstract_type";
import {ReferenceType} from "../_reference";
import {CheckSyntaxKey, SyntaxInput, syntaxIssue} from "../_syntax_input";
 
export class SourceFieldSymbol {
  public runSyntax(node: ExpressionNode, input: SyntaxInput): AbstractType {
    const token = node.getFirstToken();
    const found = input.scope.findVariable(token.getStr());
    if (found === undefined) {
      const message = "\"" + node.getFirstToken().getStr() + "\" not found, SourceFieldSymbol";
      input.issues.push(syntaxIssue(input, node.getFirstToken(), message));
      return new VoidType(CheckSyntaxKey);
    }
    input.scope.addReference(token, found, ReferenceType.DataReadReference, input.filename);
    return found.getType();
  }
}