Make Destructured nested class of MatchResult interface in JS too.

This commit is contained in:
Ilya Gorbunov
2016-02-20 21:01:13 +03:00
parent acc6cc539a
commit 7997aea5c3
2 changed files with 3 additions and 20 deletions
+2 -17
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -225,19 +225,4 @@ private fun RegExp.findNext(input: String, from: Int): MatchResult? {
override fun next(): MatchResult? = this@findNext.findNext(input, if (range.isEmpty()) range.start + 1 else range.endInclusive + 1)
}
}
// TODO: Move into MatchResult after KT-4124 is implemented
public class Destructured internal constructor(public val match: MatchResult) {
public operator inline fun component1(): String = match.groupValues[1]
public operator inline fun component2(): String = match.groupValues[2]
public operator inline fun component3(): String = match.groupValues[3]
public operator inline fun component4(): String = match.groupValues[4]
public operator inline fun component5(): String = match.groupValues[5]
public operator inline fun component6(): String = match.groupValues[6]
public operator inline fun component7(): String = match.groupValues[7]
public operator inline fun component8(): String = match.groupValues[8]
public operator inline fun component9(): String = match.groupValues[9]
public operator inline fun component10(): String = match.groupValues[10]
public fun toList(): List<String> = match.groupValues.drop(1)
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,8 +91,6 @@ public interface MatchResult {
* If the group in the regular expression is optional and there were no match captured by that group,
* corresponding component value is an empty string.
*/
@Suppress("NOTHING_TO_INLINE")
@kotlin.jvm.JvmVersion
public class Destructured internal constructor(public val match: MatchResult) {
@kotlin.internal.InlineOnly
public operator inline fun component1(): String = match.groupValues[1]