@abaplint/runtime
Version:
Transpiler - Runtime
28 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.foundIndex = void 0;
exports.tableExpression = tableExpression;
const read_table_1 = require("../statements/read_table");
const throw_error_1 = require("../throw_error");
const _parse_1 = require("./_parse");
exports.foundIndex = 0;
async function tableExpression(source, options) {
let found;
if (options.index) {
exports.foundIndex = (0, _parse_1.parse)(options.index) - 1;
found = source.array()[exports.foundIndex];
}
else if (options.withKey) {
const search = await (0, read_table_1.searchWithKeyPromise)(source.array(), options.withKey, 0, options?.usesTableLine);
found = search.found;
exports.foundIndex = search.foundIndex;
}
else {
throw new Error("TableExpression runtime: todo");
}
if (found === undefined) {
(0, throw_error_1.throwError)("CX_SY_ITAB_LINE_NOT_FOUND");
}
return found;
}
//# sourceMappingURL=table_expression.js.map