diff --git a/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt b/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt index edbbd6fef81..0ea5a58039c 100644 --- a/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt +++ b/libraries/stdlib/native-wasm/src/kotlin/text/Regex.kt @@ -7,13 +7,7 @@ package kotlin.text import kotlin.text.regex.* -@PublishedApi -internal interface FlagEnum { - val value: Int - val mask: Int -} - -private fun Iterable.toInt(): Int = this.fold(0, { value, option -> value or option.value }) +private fun Iterable.toInt(): Int = this.fold(0, { value, option -> value or option.value }) private fun fromInt(value: Int): Set = RegexOption.values().filterTo(mutableSetOf()) { value and it.mask == it.value } @@ -21,7 +15,7 @@ private fun fromInt(value: Int): Set = /** * Provides enumeration values to use to set regular expression options. */ -public actual enum class RegexOption(override val value: Int, override val mask: Int = value) : FlagEnum { +public actual enum class RegexOption(internal val value: Int, internal val mask: Int = value) { // common /** Enables case-insensitive matching. Case comparison is Unicode-aware. */ @@ -96,10 +90,10 @@ public actual class Regex internal constructor(internal val nativePattern: Patte actual constructor(pattern: String): this(Pattern(pattern)) /** Creates a regular expression from the specified [pattern] string and the specified single [option]. */ - actual constructor(pattern: String, option: RegexOption): this(Pattern(pattern, ensureUnicodeCase(option.value))) + actual constructor(pattern: String, option: RegexOption): this(Pattern(pattern, option.value)) /** Creates a regular expression from the specified [pattern] string and the specified set of [options]. */ - actual constructor(pattern: String, options: Set): this(Pattern(pattern, ensureUnicodeCase(options.toInt()))) + actual constructor(pattern: String, options: Set): this(Pattern(pattern, options.toInt())) /** The pattern string of this regular expression. */ @@ -142,9 +136,6 @@ public actual class Regex internal constructor(internal val nativePattern: Patte return result.toString() } - - // TODO: Remove - private fun ensureUnicodeCase(flags: Int) = flags } private fun doMatch(input: CharSequence, mode: Mode): MatchResult? {