J2K: Do not specify type of for loop parameter

This commit is contained in:
Pavel V. Talanov
2013-10-29 20:08:27 +04:00
parent 28f3d692ab
commit a649eb52cf
6 changed files with 7 additions and 7 deletions
@@ -77,7 +77,7 @@ public open class DoWhileStatement(condition: Expression, body: Element) : While
public open class ForeachStatement(val variable: Parameter, public open class ForeachStatement(val variable: Parameter,
val expression: Expression, val expression: Expression,
val body: Element) : Statement() { val body: Element) : Statement() {
public override fun toKotlin() = "for (" + variable.toKotlin() + " in " + public override fun toKotlin() = "for (" + variable.identifier.name + " in " +
expression.toKotlin() + ")\n" + body.toKotlin() expression.toKotlin() + ")\n" + body.toKotlin()
} }
@@ -1,4 +1,4 @@
for (n : Node? in list) for (n in list)
{ {
var i : Int = 1 var i : Int = 1
i++ i++
@@ -1,3 +1,3 @@
for (n : Node? in list) for (n in list)
{ {
} }
@@ -1,2 +1,2 @@
for (n : Node? in list) for (n in list)
i++ i++
@@ -1,2 +1,2 @@
for (n : Node? in list) for (n in list)
return n return n
+2 -2
View File
@@ -3,11 +3,11 @@ public open class ForEach() {
public open fun test() : Unit { public open fun test() : Unit {
var xs : ArrayList<Any?>? = ArrayList<Any?>() var xs : ArrayList<Any?>? = ArrayList<Any?>()
var ys : MutableList<Any?>? = LinkedList<Any?>() var ys : MutableList<Any?>? = LinkedList<Any?>()
for (x : Any? in xs!!) for (x in xs!!)
{ {
ys?.add(x) ys?.add(x)
} }
for (y : Any? in ys!!) for (y in ys!!)
{ {
xs?.add(y) xs?.add(y)
} }