This commit is contained in:
Valentin Kipyatkov
2014-11-20 17:02:49 +03:00
parent cd90ab951f
commit f8f07dc824
@@ -45,7 +45,7 @@ class PartialBodyResolveFilter(
;{ ;{
assert(body.isAncestor(elementToResolve, strict = false)) assert(body.isAncestor(elementToResolve, strict = false))
body.accept(object : JetVisitorVoid(){ body.accept(object : JetVisitorVoid() {
override fun visitNamedFunction(function: JetNamedFunction) { override fun visitNamedFunction(function: JetNamedFunction) {
super.visitNamedFunction(function) super.visitNamedFunction(function)
@@ -288,7 +288,7 @@ class PartialBodyResolveFilter(
insideLoop = false insideLoop = false
} }
else { else {
// do not make sense to search exits inside for as not necessary enter it at all // do not make sense to search exits inside while-loop as not necessary enter it at all
condition?.accept(this) condition?.accept(this)
} }
} }
@@ -343,14 +343,14 @@ class PartialBodyResolveFilter(
/** /**
* Recursively visits code but does not enter constructs that may not affect smart casts/control flow * Recursively visits code but does not enter constructs that may not affect smart casts/control flow
*/ */
private inner abstract class ControlFlowVisitor : JetVisitorVoid() { private abstract class ControlFlowVisitor : JetVisitorVoid() {
override fun visitJetElement(element: JetElement) { override fun visitJetElement(element: JetElement) {
if (element.noControlFlowInside()) return if (element.noControlFlowInside()) return
element.acceptChildren(this) element.acceptChildren(this)
} }
}
private fun JetElement.noControlFlowInside() = this is JetFunction || this is JetClass || this is JetClassBody private fun JetElement.noControlFlowInside() = this is JetFunction || this is JetClass || this is JetClassBody
}
private fun addStatementsToResolveForPlaces(places: Collection<JetExpression>) { private fun addStatementsToResolveForPlaces(places: Collection<JetExpression>) {
for (place in places) { for (place in places) {