@abaplint/runtime
Version:
Transpiler - Runtime
32 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.unpack = unpack;
const throw_error_1 = require("../throw_error");
const types_1 = require("../types");
async function unpack(source, target) {
if (source instanceof types_1.FieldSymbol) {
const pointer = source.getPointer();
if (pointer === undefined) {
throw new Error("GETWA_NOT_ASSIGNED");
}
return unpack(pointer, target);
}
if (target instanceof types_1.FieldSymbol) {
const pointer = target.getPointer();
if (pointer === undefined) {
throw new Error("GETWA_NOT_ASSIGNED");
}
return unpack(source, pointer);
}
if (source instanceof types_1.Character && target instanceof types_1.Character) {
const sourceValue = source.getTrimEnd().trimStart();
if (sourceValue.length > 0 && /^\d+$/.test(sourceValue) === false) {
(0, throw_error_1.throwError)("CX_SY_CONVERSION_NO_NUMBER");
}
target.set(sourceValue.padStart(target.getLength(), "0"));
}
else {
throw new Error("unpack, transpiler runtime todo, types");
}
}
//# sourceMappingURL=unpack.js.map