UNPKG

@abaplint/core

Version:
45 lines 2.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FieldAssignment = void 0; const Expressions = require("../../2_statements/expressions"); const basic_1 = require("../../types/basic"); const _syntax_input_1 = require("../_syntax_input"); const source_1 = require("./source"); class FieldAssignment { static runSyntax(node, input, targetType) { const fieldSub = node.findDirectExpression(Expressions.FieldSub); if (fieldSub === undefined) { const message = "FieldAssignment, FieldSub node not found"; input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message)); return; } const s = node.findDirectExpression(Expressions.Source); if (s === undefined) { const message = "FieldAssignment, Source node not found"; input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message)); return; } let type = undefined; if (targetType instanceof basic_1.StructureType) { let context = targetType; for (const c of fieldSub.getChildren()) { const text = c.concatTokens(); if (text !== "-" && context instanceof basic_1.StructureType) { context = context.getComponentByName(text); if (context === undefined && targetType.containsVoid() === false) { const message = `field ${text} does not exist in structure`; input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message)); return; } } } type = context; } else if (targetType instanceof basic_1.VoidType) { type = targetType; } source_1.Source.runSyntax(s, input, type); } } exports.FieldAssignment = FieldAssignment; //# sourceMappingURL=field_assignment.js.map