Replace Regex constructor-like functions with secondary constructors
Historically secondary constructors were not supported in Kotlin/JS, so they had to be emulated with constructor-like top level functions, now they can be rewritten as true secondary constructors. #KT-22003 Fixed
This commit is contained in:
@@ -45,6 +45,13 @@ public data class MatchGroup(val value: String)
|
|||||||
*/
|
*/
|
||||||
public class Regex(pattern: String, options: Set<RegexOption>) {
|
public class Regex(pattern: String, options: Set<RegexOption>) {
|
||||||
|
|
||||||
|
/** Creates a regular expression from the specified [pattern] string and the specified single [option]. */
|
||||||
|
public constructor(pattern: String, option: RegexOption) : this(pattern, setOf(option))
|
||||||
|
|
||||||
|
/** Creates a regular expression from the specified [pattern] string and the default options. */
|
||||||
|
public constructor(pattern: String) : this(pattern, emptySet())
|
||||||
|
|
||||||
|
|
||||||
/** The pattern string of this regular expression. */
|
/** The pattern string of this regular expression. */
|
||||||
public val pattern: String = pattern
|
public val pattern: String = pattern
|
||||||
/** The set of options that were used to create this regular expression. */
|
/** The set of options that were used to create this regular expression. */
|
||||||
@@ -170,10 +177,14 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a regular expression from the specified [pattern] string and the specified single [option]. */
|
/** Creates a regular expression from the specified [pattern] string and the specified single [option]. */
|
||||||
public fun Regex(pattern: String, option: RegexOption): Regex = Regex(pattern, setOf(option))
|
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||||
|
@JsName("Regex_sb3q2\$")
|
||||||
|
public fun Regex_0(pattern: String, option: RegexOption): Regex = Regex(pattern, setOf(option))
|
||||||
|
|
||||||
/** Creates a regular expression from the specified [pattern] string and the default options. */
|
/** Creates a regular expression from the specified [pattern] string and the default options. */
|
||||||
public fun Regex(pattern: String): Regex = Regex(pattern, emptySet())
|
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||||
|
@JsName("Regex_61zpoe\$")
|
||||||
|
public fun Regex_1(pattern: String): Regex = Regex(pattern, emptySet())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user