UNPKG

calcium-lang

Version:
19 lines 661 B
import { default as Sym } from "../symbol"; import { AttributeNotFound } from "../error"; export default function createMethod({ funcObj, boundObj, }) { const self = new Proxy({}, { get(target, property, receiver) { if (property === Sym.call) { return (args, env) => { args.unshift(boundObj); Reflect.get(funcObj, Sym.call)(args, env); }; } else if (property === Sym.class) return "method"; throw new AttributeNotFound(property.toString()); }, }); return self; } //# sourceMappingURL=method.js.map