[kotlin] Provide CFG facade for the extract function refactoring
This is the first implementation of a control flow graph facade for the extract function IDE refactoring. The exact contents of 'KtDataFlowExitPointSnapshot' will be refined later. ^KT-65762 Fixed
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
fun test() {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun test() {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fun test(): Int {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
break
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
break
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1
|
||||
]
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test(a: Int): Int {
|
||||
val b: Int = a + 10
|
||||
for (n in 1..b) {
|
||||
<expr>if (n > 5) throw Exception("")
|
||||
if (a + n > b) break
|
||||
println(b - n)</expr>
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = println(b - n)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
consume(a - b)
|
||||
if (a - b > 0) break
|
||||
consume(a + b)</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a + b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
val c: Int
|
||||
consume(a - b)
|
||||
if (a - b > 0) break
|
||||
consume(a + b)</expr>
|
||||
c = 1
|
||||
consume(c)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a + b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
else {
|
||||
consume(a - b)
|
||||
if (a - b > 0) break else consume(a + b)
|
||||
}
|
||||
</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (a + b > 0) break
|
||||
else {
|
||||
consume(a - b)
|
||||
if (a - b > 0) break else consume(a + b)
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>when {
|
||||
a + b > 0 -> break
|
||||
a - b > 0 -> break
|
||||
else -> consume(0)
|
||||
}</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = when {
|
||||
a + b > 0 -> break
|
||||
a - b > 0 -> break
|
||||
else -> consume(0)
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>if (a + b > 0) return 0
|
||||
consume(a - b)</expr>
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 0
|
||||
]
|
||||
variableReassignments = []
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>when (a + b) {
|
||||
0 -> return 0
|
||||
1 -> consume(1)
|
||||
else -> consume(2)
|
||||
}
|
||||
</expr>
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = when (a + b) {
|
||||
0 -> return 0
|
||||
1 -> consume(1)
|
||||
else -> consume(2)
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 0
|
||||
]
|
||||
variableReassignments = []
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>if (a + b > 0) return 0
|
||||
else if (a - b < 0) consume(a - b)
|
||||
else consume(0)</expr>
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (a + b > 0) return 0
|
||||
else if (a - b < 0) consume(a - b)
|
||||
else consume(0)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 0
|
||||
]
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun test() {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
continue
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
continue
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fun test(): Int {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1
|
||||
]
|
||||
variableReassignments = []
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test() {
|
||||
consume(1)
|
||||
<expr>try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
"error"
|
||||
}</expr>
|
||||
}
|
||||
|
||||
fun consume(n: Int) {}
|
||||
|
||||
@Throws(FooException::class)
|
||||
fun dangerous(): String {
|
||||
return "foo"
|
||||
}
|
||||
|
||||
class FooException : Exception()
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
"error"
|
||||
}
|
||||
type = kotlin.String
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test() {
|
||||
consume(1)
|
||||
<expr>try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
throw e
|
||||
}</expr>
|
||||
}
|
||||
|
||||
fun consume(n: Int) {}
|
||||
|
||||
@Throws(FooException::class)
|
||||
fun dangerous(): String {
|
||||
return "foo"
|
||||
}
|
||||
|
||||
class FooException : Exception()
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
throw e
|
||||
}
|
||||
type = kotlin.String
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>if (a + b > 0) return 1
|
||||
else if (a - b < 0) return 2
|
||||
else return b</expr>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1,
|
||||
return 2,
|
||||
return b
|
||||
]
|
||||
variableReassignments = []
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>when (a + b) {
|
||||
0 -> return b
|
||||
1 -> return -b
|
||||
else -> return a - b
|
||||
}</expr>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return b,
|
||||
return -b,
|
||||
return a - b
|
||||
]
|
||||
variableReassignments = []
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun foo(a: Int): Int {
|
||||
a.let {
|
||||
<expr>if (it > 0) return it else return@foo -it</expr>
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return it,
|
||||
return@foo -it
|
||||
]
|
||||
variableReassignments = []
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun foo(a: Int): Int {
|
||||
a.let {
|
||||
<expr>if (it > 0) return@foo it else return -it</expr>
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return@foo it,
|
||||
return -it
|
||||
]
|
||||
variableReassignments = []
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fun test() {
|
||||
outer@ while (cond()) {
|
||||
consume(1)
|
||||
while (cond()) {
|
||||
consume(2)
|
||||
<expr>if (cond()) {
|
||||
break
|
||||
} else if (cond()) {
|
||||
break@outer
|
||||
}</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (cond()) {
|
||||
break
|
||||
} else if (cond()) {
|
||||
break@outer
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break@outer
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun test(flag: Boolean): Int {
|
||||
block {
|
||||
<expr>if (flag) {
|
||||
return 1
|
||||
}
|
||||
|
||||
consume("foo")
|
||||
return@block</expr>
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
inline fun block(block: () -> Unit) {}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1
|
||||
]
|
||||
variableReassignments = []
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break
|
||||
consume(a - b)
|
||||
return</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
loop1@ for (p in 1..b) {
|
||||
loop2@ for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break@loop2
|
||||
if (a - b > 0) continue@loop1</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (a - b > 0) continue@loop1
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break@loop2,
|
||||
continue@loop1
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) continue
|
||||
consume(a - b)
|
||||
return</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break
|
||||
consume(a - b)</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) continue
|
||||
consume(a - b)</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (b + a > 0) return
|
||||
consume(a - b)</expr>
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun example(i: Int) {
|
||||
when (i) {
|
||||
1 -> {
|
||||
<expr>if (i > 5) {
|
||||
consume("true")
|
||||
}
|
||||
else {
|
||||
consume("false")
|
||||
return
|
||||
}
|
||||
consume("!!")</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume("!!")
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
fun example(i: Int) {
|
||||
when (i) {
|
||||
1 -> {
|
||||
<expr>if (i > 5) {
|
||||
consume("true")
|
||||
}
|
||||
else {
|
||||
consume("false")
|
||||
return
|
||||
}
|
||||
consume("!!")</expr>
|
||||
}
|
||||
2 -> {
|
||||
consume("another")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume("!!")
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
loop1@ for (p in 1..b) {
|
||||
loop2@ for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break@loop1
|
||||
consume(a - b)
|
||||
break@loop2</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break@loop1,
|
||||
break@loop2
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun test() {
|
||||
x@ while (cond()) {
|
||||
<expr>consume(5)
|
||||
break@x</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun consume(n: Int) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break@x
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
consume(a - b)
|
||||
break</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
else {
|
||||
consume(a - b)
|
||||
break
|
||||
}</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>when {
|
||||
a + b > 0 -> break
|
||||
a - b > 0 -> break
|
||||
else -> {
|
||||
consume(0)
|
||||
break
|
||||
}
|
||||
}</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
Reference in New Issue
Block a user