Store connection between files and lazy package fragment descriptor
LazyPackageDescriptor objects are going to be used as input for light class generation. Java code generator expects to find connection between descriptors and files in binding context.
This commit is contained in:
+7
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -74,6 +74,12 @@ public class FileBasedPackageMemberDeclarationProvider extends AbstractPsiBasedD
|
||||
return factory.getPackageDeclarations(fqName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetFile> getPackageFiles() {
|
||||
return packageFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Declarations for package " + fqName;
|
||||
|
||||
+7
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,8 @@ package org.jetbrains.jet.lang.resolve.lazy.declarations;
|
||||
|
||||
import com.intellij.psi.NavigatablePsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -28,4 +30,8 @@ public interface PackageMemberDeclarationProvider extends DeclarationProvider {
|
||||
|
||||
@NotNull
|
||||
Collection<NavigatablePsiElement> getPackageDeclarations(FqName fqName);
|
||||
|
||||
@NotNull
|
||||
@ReadOnly
|
||||
Collection<JetFile> getPackageFiles();
|
||||
}
|
||||
|
||||
+7
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.DeclarationDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ForceResolveUtil;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.LazyEntity;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
|
||||
@@ -49,6 +51,10 @@ public class LazyPackageDescriptor extends DeclarationDescriptorImpl implements
|
||||
this.declarationProvider = declarationProvider;
|
||||
|
||||
this.memberScope = new LazyPackageMemberScope(resolveSession, declarationProvider, this);
|
||||
|
||||
for (JetFile file : declarationProvider.getPackageFiles()) {
|
||||
this.resolveSession.getTrace().record(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file, this);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+6
@@ -90,4 +90,10 @@ public class StubPackageMemberDeclarationProvider extends AbstractStubDeclaratio
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetFile> getPackageFiles() {
|
||||
return JetAllPackagesIndex.getInstance().get(fqName.asString(), project, searchScope);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user