@abaplint/runtime
Version:
Transpiler - Runtime
93 lines • 3.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.describe = describe;
const types_1 = require("../types");
function describe(input) {
// console.dir(input);
if (input.type) {
if (input.field instanceof types_1.FieldSymbol) {
describe({ field: input.field.getPointer(), type: input.type, length: input.length, mode: input.mode });
return;
}
if (input.field instanceof types_1.Table || input.field instanceof types_1.HashedTable) {
input.type.set("h");
}
else if (input.field instanceof types_1.Character || typeof input.field === "string") {
input.type.set("C");
}
else if (input.field instanceof types_1.Integer) {
input.type.set("I");
}
else if (input.field instanceof types_1.Integer8) {
input.type.set("8");
}
else if (input.field instanceof types_1.Date) {
input.type.set("D");
}
else if (input.field instanceof types_1.Time) {
input.type.set("T");
}
else if (input.field instanceof types_1.Float) {
input.type.set("F");
}
else if (input.field instanceof types_1.Numc) {
input.type.set("N");
}
else if (input.field instanceof types_1.Hex || input.field instanceof types_1.HexUInt8) {
input.type.set("X");
}
else if (input.field instanceof types_1.Packed) {
input.type.set("P");
}
else if (input.field instanceof types_1.String) {
input.type.set("g");
}
else if (input.field instanceof types_1.XString) {
input.type.set("y");
}
else if (input.field instanceof types_1.DecFloat34) {
input.type.set("e");
}
else if (input.field instanceof types_1.Structure) {
input.type.set("u");
}
else if (input.field instanceof types_1.ABAPObject) {
input.type.set("r");
}
else if (input.field instanceof types_1.DataReference) {
input.type.set("l");
}
else {
throw new Error("DESCRIBE, todo, transpiler, " + input.field.constructor.name);
}
}
if (input.field instanceof types_1.FieldSymbol) {
input.field = input.field.getPointer();
}
if (input.length) {
if (input.field instanceof types_1.Character
|| input.field instanceof types_1.Packed
|| input.field instanceof types_1.Numc
|| input.field instanceof types_1.HexUInt8
|| input.field instanceof types_1.Hex) {
input.length.set(input.field.getLength());
}
else {
throw new Error("DESCRIBE length, unsupported or todo, " + input.field.constructor.name);
}
}
if (input.decimals) {
if (input.field instanceof types_1.Packed) {
input.decimals.set(input.field.getDecimals());
}
else {
throw new Error("DESCRIBE decimals, unsupported or todo, " + input.field.constructor.name);
}
}
if (input.table) {
// @ts-ignore
abap.builtin.sy.get().tfill.set(input.table.getArrayLength());
input.lines?.set(input.table.getArrayLength());
}
}
//# sourceMappingURL=describe.js.map