mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PsiBuilder: don't reuse collapsed tokens if the element type doesn't say so
GitOrigin-RevId: 3f7ba09e40e1e94f34612c4bb9b92f46bc4f2ea9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1e104080e2
commit
f7c259b7ec
@@ -163,7 +163,7 @@ public class PsiBuilderImpl extends UnprotectedUserDataHolder implements PsiBuil
|
||||
private TokenSequence performLexing(@Nullable Object parentCachingNode) {
|
||||
TokenSequence fromParent = null;
|
||||
|
||||
if (parentCachingNode instanceof LazyParseableToken) {
|
||||
if (parentCachingNode instanceof LazyParseableToken && shouldReuseCollapsedTokens(((LazyParseableToken)parentCachingNode).getTokenType())) {
|
||||
fromParent = ((LazyParseableToken)parentCachingNode).getParsedTokenSequence();
|
||||
assert fromParent == null || fromParent.lexStarts[fromParent.lexemeCount] == myText.length();
|
||||
ProgressIndicatorProvider.checkCanceled();
|
||||
@@ -1253,7 +1253,7 @@ public class PsiBuilderImpl extends UnprotectedUserDataHolder implements PsiBuil
|
||||
final int end = myLexStarts[startMarker.getEndIndex()];
|
||||
final IElementType markerType = startMarker.myType;
|
||||
final TreeElement leaf = createLeaf(markerType, start, end);
|
||||
if (markerType instanceof ILazyParseableElementTypeBase && ((ILazyParseableElementTypeBase)markerType).reuseCollapsedTokens() &&
|
||||
if (shouldReuseCollapsedTokens(markerType) &&
|
||||
startMarker.myLexemeIndex < startMarker.getEndIndex()) {
|
||||
int length = startMarker.getEndIndex() - startMarker.myLexemeIndex;
|
||||
int[] relativeStarts = new int[length + 1];
|
||||
@@ -1269,6 +1269,10 @@ public class PsiBuilderImpl extends UnprotectedUserDataHolder implements PsiBuil
|
||||
return startMarker.getEndIndex();
|
||||
}
|
||||
|
||||
private static boolean shouldReuseCollapsedTokens(IElementType collapsed) {
|
||||
return collapsed instanceof ILazyParseableElementTypeBase && ((ILazyParseableElementTypeBase)collapsed).reuseCollapsedTokens();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static CompositeElement createComposite(@NotNull StartMarker marker, @Nullable ASTFactory astFactory) {
|
||||
final IElementType type = marker.myType;
|
||||
|
||||
Reference in New Issue
Block a user