Inline function: process usages in children-first order
This commit is contained in:
+3
-3
@@ -1,8 +1,8 @@
|
||||
class Point(val x: Double, val y: Double) {
|
||||
// After sqr inlining, only first usage of sqr is replaced
|
||||
fun distance(other: Point): Double {
|
||||
val x1 = y - other.y
|
||||
val x2 = x - other.x
|
||||
return Math.sqrt(x2 * x2 + x1 * x1)
|
||||
val x1 = x - other.x
|
||||
val x2 = y - other.y
|
||||
return Math.sqrt(x1 * x1 + x2 * x2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user