X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/f0ab8cc83ab12f8d8b995358e3953e96be3d5918..3b7b484743da35b1772b3fb04378dc88f75fc41f:/string.js?ds=inline diff --git a/string.js b/string.js index 28412fc..3dc39ac 100644 --- a/string.js +++ b/string.js @@ -10,6 +10,7 @@ import { bind, call, identity, makeCallable } from "./function.js"; import { defineOwnProperties, + getOwnPropertyDescriptors, getPrototype, objectCreate, setPrototype, @@ -213,12 +214,25 @@ export const { return call(getUnicode, this.#regExp, []); } }; - const matcherPrototype = setPrototype( - Matcher.prototype, - rePrototype, + + const matcherConstructor = defineOwnProperties( + class extends RegExp { + constructor(...args) { + return new Matcher(...args); + } + }, + { + name: { value: "Matcher" }, + length: { value: 1 }, + }, + ); + const matcherPrototype = defineOwnProperties( + matcherConstructor.prototype, + getOwnPropertyDescriptors(Matcher.prototype), + { constructor: { value: matcherConstructor } }, ); - return { Matcher }; + return { Matcher: matcherConstructor }; })(); export const {