X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/f0ab8cc83ab12f8d8b995358e3953e96be3d5918..fb3e0d562e2dbe9e3ea911a80bfdabc8851f92b2:/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 {