UNPKG

@abaplint/runtime

Version:
22 lines 903 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dynamicCallLookup = dynamicCallLookup; const throw_error_1 = require("./throw_error"); function dynamicCallLookup(obj, methodName) { let name = typeof methodName === "string" ? methodName : methodName.get().toLowerCase().trimEnd(); name = name.replaceAll("~", "$").replaceAll("/", "$"); let ret = obj[name]; if (ret !== undefined) { ret = ret.bind(obj); } else if (obj.FRIENDS_ACCESS_INSTANCE !== undefined) { // it might be private, note this currently does not respect encapsulation properly // FRIENDS_ACCESS_INSTANCE is already .bind()'ed ret = obj.FRIENDS_ACCESS_INSTANCE[name]; } if (ret === undefined) { (0, throw_error_1.throwError)("CX_SY_DYN_CALL_ILLEGAL_METHOD"); } return ret; } //# sourceMappingURL=dynamic_call_lookup.js.map