@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
31 lines (29 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetCallableHelper = void 0;
const tslib_1 = require("tslib");
const safe_stable_stringify_1 = tslib_1.__importDefault(require("safe-stable-stringify"));
const constants_1 = require("../../constants");
const Helper_1 = require("../Helper");
class GetCallableHelper extends Helper_1.Helper {
constructor(options = { bindThis: false }) {
super();
this.bindThis = options.bindThis || false;
this.overwriteThis = options.overwriteThis || false;
}
static getKey(options = { bindThis: false }) {
const bindThis = options.bindThis || false;
const overwriteThis = options.overwriteThis || false;
return safe_stable_stringify_1.default({ bindThis, overwriteThis });
}
emit(sb, node, optionsIn) {
const options = sb.pushValueOptions(optionsIn);
sb.emitPushInt(node, constants_1.InternalObjectProperty.Call);
sb.emitHelper(node, options, sb.helpers.getInternalObjectProperty);
if (this.bindThis) {
sb.emitHelper(node, options, sb.helpers.bindFunctionThis({ overwrite: this.overwriteThis }));
}
}
}
exports.GetCallableHelper = GetCallableHelper;
//# sourceMappingURL=GetCallableHelper.js.map