From 705f3ce4387f2474279ad961f68776b35ed31026 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Thu, 21 Jun 2018 18:22:12 +0300 Subject: [PATCH] Remove debugging mutable state from Regex classes. (#1710) --- runtime/src/main/kotlin/kotlin/text/regex/Pattern.kt | 4 ---- .../src/main/kotlin/kotlin/text/regex/sets/AbstractSet.kt | 8 +------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/runtime/src/main/kotlin/kotlin/text/regex/Pattern.kt b/runtime/src/main/kotlin/kotlin/text/regex/Pattern.kt index 18fff30dda4..11a37ed4fdd 100644 --- a/runtime/src/main/kotlin/kotlin/text/regex/Pattern.kt +++ b/runtime/src/main/kotlin/kotlin/text/regex/Pattern.kt @@ -71,10 +71,6 @@ internal class Pattern(val pattern: String, flags: Int = 0) { if (flags != 0 && flags or flagsBitMask != flagsBitMask) { throw IllegalArgumentException() } - - // It's for debug purposes. - AbstractSet.counter = 1 - startNode = processExpression(-1, this.flags, null) if (!lexemes.isEmpty()) { diff --git a/runtime/src/main/kotlin/kotlin/text/regex/sets/AbstractSet.kt b/runtime/src/main/kotlin/kotlin/text/regex/sets/AbstractSet.kt index e6902b90f51..9eed5fde586 100644 --- a/runtime/src/main/kotlin/kotlin/text/regex/sets/AbstractSet.kt +++ b/runtime/src/main/kotlin/kotlin/text/regex/sets/AbstractSet.kt @@ -54,9 +54,6 @@ internal abstract class AbstractSet(val type: Int = 0) { const val TYPE_QUANT = 1 shl 3 const val TYPE_DOTSET = 0x80000000.toInt() or '.'.toInt() - /** Counter for debugging purposes, represent unique node index. */ - var counter = 1 - val dummyNext = object : AbstractSet() { override var next: AbstractSet get() = throw AssertionError("This method is not expected to be called.") @@ -72,11 +69,8 @@ internal abstract class AbstractSet(val type: Int = 0) { var secondPassVisited = false abstract var next: AbstractSet - // These properties and toString() method are for debug purposes. - protected var debugIndex = AbstractSet.counter++.toString() protected open val name: String - get() = "" - override fun toString(): String = "<$debugIndex:$name>" + get() = "" /** * Checks if this node matches in given position and recursively call