mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -759,17 +759,17 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
|
||||
@Override
|
||||
public PsiElement getFirstChild() {
|
||||
return SharedImplUtil.getFirstChild(calcTreeElement());
|
||||
return SharedImplUtil.getFirstChild(getNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getLastChild() {
|
||||
return SharedImplUtil.getLastChild(calcTreeElement());
|
||||
return SharedImplUtil.getLastChild(getNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptChildren(@NotNull PsiElementVisitor visitor) {
|
||||
SharedImplUtil.acceptChildren(visitor, calcTreeElement());
|
||||
SharedImplUtil.acceptChildren(visitor, getNode());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -128,7 +128,9 @@ public class ResolveCache {
|
||||
boolean isPoly,
|
||||
boolean isPhysical) {
|
||||
ProgressIndicatorProvider.checkCanceled();
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
if (isPhysical) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
}
|
||||
|
||||
int index = getIndex(isPhysical, incompleteCode, isPoly);
|
||||
ConcurrentMap<TRef, TResult> map = getMap(index);
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.CheckUtil;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.psi.impl.ElementBase;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -40,7 +41,7 @@ public class SharedImplUtil {
|
||||
}
|
||||
|
||||
public static PsiElement getParent(ASTNode thisElement) {
|
||||
if (CHECK_FOR_READ_ACTION) {
|
||||
if (CHECK_FOR_READ_ACTION && thisElement instanceof ElementBase) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
}
|
||||
return SourceTreeToPsiMap.treeElementToPsi(thisElement.getTreeParent());
|
||||
@@ -82,7 +83,7 @@ public class SharedImplUtil {
|
||||
}
|
||||
|
||||
public static FileElement findFileElement(@NotNull ASTNode element) {
|
||||
if (CHECK_FOR_READ_ACTION) {
|
||||
if (CHECK_FOR_READ_ACTION && element instanceof ElementBase) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
}
|
||||
ASTNode parent = element.getTreeParent();
|
||||
@@ -180,8 +181,8 @@ public class SharedImplUtil {
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void acceptChildren(PsiElementVisitor visitor, CompositeElement root) {
|
||||
TreeElement childNode = root.getFirstChildNode();
|
||||
public static void acceptChildren(PsiElementVisitor visitor, ASTNode root) {
|
||||
ASTNode childNode = root.getFirstChildNode();
|
||||
|
||||
while (childNode != null) {
|
||||
final PsiElement psi;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class StubTreeBuilder {
|
||||
|
||||
CharSequence contentAsText = inputData.getContentAsText();
|
||||
FileContentImpl fileContent = (FileContentImpl)inputData;
|
||||
PsiFile psi = fileContent.getPsiFileAccountingForUnsavedDocument();
|
||||
PsiFile psi = fileContent.getPsiFileForPsiDependentIndex();
|
||||
psi = psi.getViewProvider().getStubBindingRoot();
|
||||
psi.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, contentAsText);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class StubTreeBuilder {
|
||||
if (stubFileElementType != null) {
|
||||
StubBuilder stubBuilder = stubFileElementType.getBuilder();
|
||||
if (stubBuilder instanceof LightStubBuilder) {
|
||||
LightStubBuilder.FORCED_AST.set(fileContent.getLighterAST());
|
||||
LightStubBuilder.FORCED_AST.set(fileContent.getLighterASTForPsiDependentIndex());
|
||||
}
|
||||
data = stubBuilder.buildStubTree(psi);
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ public final class FileContentImpl extends UserDataHolderBase implements FileCon
|
||||
return psi;
|
||||
}
|
||||
|
||||
public @NotNull LighterAST getLighterAST() {
|
||||
public @NotNull LighterAST getLighterASTForPsiDependentIndex() {
|
||||
LighterAST lighterAST = getUserData(IndexingDataKeys.LIGHTER_AST_NODE_KEY);
|
||||
if (lighterAST == null) {
|
||||
lighterAST = getPsiFileAccountingForUnsavedDocument().getNode().getLighterAST();
|
||||
lighterAST = getPsiFileForPsiDependentIndex().getNode().getLighterAST();
|
||||
assert lighterAST != null;
|
||||
putUserData(IndexingDataKeys.LIGHTER_AST_NODE_KEY, lighterAST);
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public final class FileContentImpl extends UserDataHolderBase implements FileCon
|
||||
myHash = hash;
|
||||
}
|
||||
|
||||
public PsiFile getPsiFileAccountingForUnsavedDocument() {
|
||||
public PsiFile getPsiFileForPsiDependentIndex() {
|
||||
Document document = FileDocumentManager.getInstance().getCachedDocument(getFile());
|
||||
PsiFile psi = null;
|
||||
if (document != null) {
|
||||
|
||||
@@ -119,7 +119,7 @@ public class DuplicatesIndex extends FileBasedIndexExtension<Integer, TIntArrayL
|
||||
|
||||
if (profile instanceof LightDuplicateProfile && ourEnabledLightProfiles) {
|
||||
final THashMap<Integer, TIntArrayList> result = new THashMap<Integer, TIntArrayList>();
|
||||
LighterAST ast = fileContent.getLighterAST();
|
||||
LighterAST ast = fileContent.getLighterASTForPsiDependentIndex();
|
||||
assert ast != null;
|
||||
((LightDuplicateProfile)profile).process(ast, new LightDuplicateProfile.Callback() {
|
||||
@Override
|
||||
@@ -134,7 +134,7 @@ public class DuplicatesIndex extends FileBasedIndexExtension<Integer, TIntArrayL
|
||||
MyFragmentsCollector collector = new MyFragmentsCollector(profile, ((LanguageFileType)type).getLanguage());
|
||||
DuplocateVisitor visitor = profile.createVisitor(collector, true);
|
||||
|
||||
visitor.visitNode(fileContent.getPsiFileAccountingForUnsavedDocument());
|
||||
visitor.visitNode(fileContent.getPsiFileForPsiDependentIndex());
|
||||
|
||||
return collector.getMap();
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
|
||||
|
||||
private Integer getHashOfContent(FileContent content) throws IOException {
|
||||
if (myIsPsiBackedIndex && myHasSnapshotMapping && content instanceof FileContentImpl) {
|
||||
// psi backed index should use existing psi to build index value (FileContentImpl.getPsiFileAccountingForUnsavedDocument())
|
||||
// psi backed index should use existing psi to build index value (FileContentImpl.getPsiFileForPsiDependentIndex())
|
||||
// so we should use different bytes to calculate hash(Id)
|
||||
Integer previouslyCalculatedUncommittedHashId = content.getUserData(ourSavedUncommittedHashIdKey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user