A couple utility methods

PsiCodegenPredictor.getFileForCodegenNamedClass() returns JetFile which
contains a declaration which will produce a class with a given name.
PsiCodegenPredictor.getFileForNamespacePartName() returns JetFile which
produces a namespace part with the given name.

BindingContextUtils.getContainingFile() returns JetFile which contains a
declaration which is matched to a given descriptor.

DescriptorUtils.findTopLevelParent() finds a top-level (i.e. its containing
declaration is NamespaceDescriptor) parent for a descriptor.

Also DescriptorUtils.isTopLevelFunction() is changed a little to accept not
only a function, but any descriptor
This commit is contained in:
Alexander Udalov
2012-10-24 15:44:21 +04:00
parent a8798de8d0
commit 880852861c
4 changed files with 70 additions and 3 deletions
@@ -187,7 +187,7 @@ public class JetFunctionInsertHandler implements InsertHandler<LookupElement> {
return;
}
if (DescriptorUtils.isTopLevelFunction(functionDescriptor)) {
if (DescriptorUtils.isTopLevelDeclaration(functionDescriptor)) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {