UNPKG

@abaplint/core

Version:
43 lines 1.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ComponentName = void 0; const Basic = require("../../types/basic"); const _syntax_input_1 = require("../_syntax_input"); class ComponentName { static runSyntax(context, node, input) { if (context instanceof Basic.VoidType) { return context; } const nameToken = node.getFirstToken(); const name = nameToken.getStr(); if (context instanceof Basic.StructureType) { const ret = context.getComponentByName(name); if (ret === undefined) { input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, "Component \"" + name + "\" not found in structure")); return Basic.VoidType.get(_syntax_input_1.CheckSyntaxKey); } return ret; } if (context instanceof Basic.TableType && context.isWithHeader() === true) { const rowType = context.getRowType(); if (rowType instanceof Basic.VoidType) { return context; } else if (name.toUpperCase() === "TABLE_LINE") { return rowType; } else if (rowType instanceof Basic.StructureType) { const ret = rowType.getComponentByName(name); if (ret === undefined) { input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, "Component \"" + name + "\" not found in structure")); return Basic.VoidType.get(_syntax_input_1.CheckSyntaxKey); } return ret; } } input.issues.push((0, _syntax_input_1.syntaxIssue)(input, nameToken, "Not a structure, ComponentName, \"" + name + "\"")); return Basic.VoidType.get(_syntax_input_1.CheckSyntaxKey); } } exports.ComponentName = ComponentName; //# sourceMappingURL=component_name.js.map