UNPKG

@abaplint/core

Version:
48 lines 2.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CallFunction = void 0; const Expressions = require("../../2_statements/expressions"); const source_1 = require("../expressions/source"); const target_1 = require("../expressions/target"); const field_chain_1 = require("../expressions/field_chain"); const _reference_1 = require("../_reference"); const version_1 = require("../../../version"); const _syntax_input_1 = require("../_syntax_input"); class CallFunction { runSyntax(node, input) { // todo, lots of work here, similar to receive.ts const name = node.findFirstExpression(Expressions.FunctionName); const chain = name === null || name === void 0 ? void 0 : name.findFirstExpression(Expressions.FieldChain); if (chain) { field_chain_1.FieldChain.runSyntax(chain, input, _reference_1.ReferenceType.DataReadReference); } else if (input.scope.getVersion() === version_1.Version.Cloud && node.findDirectExpression(Expressions.Destination) === undefined) { const functionName = name === null || name === void 0 ? void 0 : name.concatTokens().replace(/'/g, ""); if (input.scope.findFunctionModule(functionName) === undefined) { const message = `Function module "${functionName}" not found/released`; input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message)); return; } } // just recurse for (const s of node.findAllExpressions(Expressions.Source)) { source_1.Source.runSyntax(s, input); } for (const s of node.findAllExpressions(Expressions.SimpleSource3)) { source_1.Source.runSyntax(s, input); } for (const t of node.findAllExpressions(Expressions.Target)) { target_1.Target.runSyntax(t, input); } for (const s of node.findDirectExpressions(Expressions.SimpleSource2)) { source_1.Source.runSyntax(s, input); } const exceptions = node.findFirstExpression(Expressions.ParameterException); for (const s of (exceptions === null || exceptions === void 0 ? void 0 : exceptions.findAllExpressions(Expressions.SimpleFieldChain)) || []) { field_chain_1.FieldChain.runSyntax(s, input, _reference_1.ReferenceType.DataReadReference); } } } exports.CallFunction = CallFunction; //# sourceMappingURL=call_function.js.map