Drop Progression<T> and its deprecated properties: start, end, increment.

Drop deprecated range extensions.
Make progression constructors private.
This commit is contained in:
Ilya Gorbunov
2016-01-14 20:19:52 +03:00
parent 6dd8470835
commit 91f4cf0ebc
15 changed files with 45 additions and 257 deletions
+3 -3
View File
@@ -120,7 +120,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
val foundMatch = match!!
sb.append(input, lastStart, foundMatch.range.start)
sb.append(transform(foundMatch))
lastStart = foundMatch.range.end + 1
lastStart = foundMatch.range.endInclusive + 1
match = foundMatch.next()
} while (lastStart < length && match != null)
@@ -154,7 +154,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
for (match in matches) {
result.add(input.subSequence(lastStart, match.range.start).toString())
lastStart = match.range.end + 1
lastStart = match.range.endInclusive + 1
}
result.add(input.subSequence(lastStart, input.length()).toString())
return result
@@ -223,7 +223,7 @@ private fun RegExp.findNext(input: String, from: Int): MatchResult? {
return groupValues_!!
}
override fun next(): MatchResult? = this@findNext.findNext(input, if (range.isEmpty()) range.start + 1 else range.end + 1)
override fun next(): MatchResult? = this@findNext.findNext(input, if (range.isEmpty()) range.start + 1 else range.endInclusive + 1)
}
}
@@ -183,9 +183,9 @@ fun translateForExpression(expression: KtForExpression, context: TranslationCont
fun getProperty(funName: String): JsExpression = JsNameRef(funName, rangeExpression.reference())
val start = context.declareTemporary(getProperty("start"))
val end = context.declareTemporary(getProperty("end"))
val increment = context.declareTemporary(getProperty("increment"))
val start = context.declareTemporary(getProperty("first"))
val end = context.declareTemporary(getProperty("last"))
val increment = context.declareTemporary(getProperty("step"))
val body = translateBody(null)
val initExpression = newVar(parameterName, start.reference())
+1 -28
View File
@@ -859,18 +859,12 @@
return [Kotlin.modules['builtins'].kotlin.collections.Iterable];
},
function (start, end, step) {
this.start = start;
this.endInclusive = end;
this.first = start;
this.last = getProgressionFinalElement(start, end, step);
this.step = step;
this.increment = step;
if (this.step === 0)
throw new Kotlin.IllegalArgumentException('Step must be non-zero');
}, {
end: { get: function () {
return this.endInclusive;
}},
iterator: function () {
return new Kotlin.RangeIterator(this.first, this.last, this.step);
},
@@ -895,9 +889,6 @@
this.start = start;
this.endInclusive = endInclusive;
}, {
end: { get: function () {
return this.endInclusive;
}},
contains_htax2k$: function (item) {
return this.start <= item && item <= this.endInclusive;
},
@@ -947,18 +938,12 @@
return [Kotlin.modules['builtins'].kotlin.collections.Iterable];
},
function (start, end, step) {
this.start = start;
this.endInclusive = end;
this.first = start;
this.last = getProgressionFinalElementLong(start, end, step);
this.step = step;
this.increment = step;
if (this.step.isZero())
throw new Kotlin.IllegalArgumentException('Step must be non-zero');
}, {
end: { get: function () {
return this.endInclusive;
}},
iterator: function () {
return new Kotlin.LongRangeIterator(this.first, this.last, this.step);
},
@@ -983,9 +968,6 @@
this.start = start;
this.endInclusive = endInclusive;
}, {
end: { get: function () {
return this.endInclusive;
}},
contains_htax2k$: function (item) {
return this.start.compareTo_za3rmp$(item) <= 0 && item.compareTo_za3rmp$(this.endInclusive) <= 0;
},
@@ -1026,20 +1008,14 @@
return [Kotlin.modules['builtins'].kotlin.collections.Iterable];
},
function (start, end, step) {
this.start = start;
this.endInclusive = end;
this.first = start;
this.startCode = start.charCodeAt(0);
this.endCode = getProgressionFinalElement(this.startCode, end.charCodeAt(0), step);
this.last = String.fromCharCode(this.endCode);
this.step = step;
this.increment = step;
if (this.increment === 0)
if (this.step === 0)
throw new Kotlin.IllegalArgumentException('Increment must be non-zero');
}, {
end: { get: function () {
return this.endInclusive;
}},
iterator: function () {
return new Kotlin.CharRangeIterator(this.startCode, this.endCode, this.step);
},
@@ -1065,9 +1041,6 @@
this.start = start;
this.endInclusive = endInclusive;
}, {
end: { get: function () {
return this.endInclusive;
}},
contains_htax2k$: function (item) {
return this.start <= item && item <= this.endInclusive;
},