Introduce ResolutionScope::definitelyDoesNotContainName

Also add some obvious implementations

This method might be used in resolution to filter out
inapplicable scopes
This commit is contained in:
Denis Zharkov
2017-08-15 12:27:21 +07:00
parent 7b5842a088
commit 94356e891b
7 changed files with 28 additions and 1 deletions
@@ -124,4 +124,7 @@ abstract class LexicalScopeStorage(
} while (rest != null)
return result
}
override fun definitelyDoesNotContainName(name: Name) =
functionsByName?.get(name) == null && variablesAndClassifiersByName?.get(name) == null
}
@@ -55,6 +55,8 @@ interface LexicalScope : HierarchicalScope {
override val kind: LexicalScopeKind
get() = LexicalScopeKind.EMPTY
override fun definitelyDoesNotContainName(name: Name) = true
override fun printStructure(p: Printer) {
p.println("Base lexical scope with owner = $ownerDescriptor and parent = $parent")
}
@@ -123,6 +125,8 @@ interface ImportingScope : HierarchicalScope {
override fun printStructure(p: Printer) {
p.println("ImportingScope.Empty")
}
override fun definitelyDoesNotContainName(name: Name) = true
}
}