mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
single-pass stub hierarchy package name reading
This commit is contained in:
@@ -92,7 +92,7 @@ class SerializedUnit {
|
||||
}
|
||||
|
||||
private static void enterUnit(UnitInputStream in) throws IOException {
|
||||
PackageSymbol pkg = in.stubEnter.enterPackage(in);
|
||||
PackageSymbol pkg = in.stubEnter.readPackageName(in);
|
||||
byte type = in.readByte();
|
||||
long[] imports = type == IndexTree.BYTECODE ? Imports.EMPTY_ARRAY : Imports.readImports(in);
|
||||
UnitInfo unitInfo = UnitInfo.mkUnitInfo(type, imports);
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.psi.stubsHierarchy.impl;
|
||||
|
||||
import com.intellij.psi.impl.java.stubs.hierarchy.IndexTree;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.io.DataInputOutputUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.DataInput;
|
||||
@@ -39,8 +40,16 @@ public class StubEnter {
|
||||
myStubHierarchyConnector = new StubHierarchyConnector(myNameEnvironment, symbols);
|
||||
}
|
||||
|
||||
PackageSymbol enterPackage(DataInput in) throws IOException {
|
||||
return mySymbols.enterPackage(myNameEnvironment.readQualifiedName(in));
|
||||
PackageSymbol readPackageName(DataInput in) throws IOException {
|
||||
PackageSymbol pkg = mySymbols.myRootPackage;
|
||||
int qname = 0;
|
||||
int len = DataInputOutputUtil.readINT(in);
|
||||
for (int i = 0; i < len; i++) {
|
||||
int shortName = in.readInt();
|
||||
qname = myNameEnvironment.qualifiedName(qname, shortName);
|
||||
pkg = mySymbols.enterPackage(qname, shortName, pkg);
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
|
||||
ClassSymbol classEnter(UnitInfo info,
|
||||
|
||||
@@ -28,9 +28,9 @@ import java.util.*;
|
||||
* but other {@link MemberSymbol}s are also sometimes needed for working with anonymous or local classes.
|
||||
*/
|
||||
abstract class Symbol {
|
||||
public int myFlags;
|
||||
public int myShortName;
|
||||
public final Symbol myOwner;
|
||||
int myFlags;
|
||||
@ShortName final int myShortName;
|
||||
final Symbol myOwner;
|
||||
|
||||
public Symbol(int flags, Symbol owner, int name) {
|
||||
this.myFlags = flags;
|
||||
|
||||
@@ -25,11 +25,9 @@ public class Symbols {
|
||||
myPackages.put(0, myRootPackage);
|
||||
}
|
||||
|
||||
public PackageSymbol enterPackage(@QNameId int qualifiedName) {
|
||||
PackageSymbol enterPackage(@QNameId int qualifiedName, @ShortName int shortName, PackageSymbol owner) {
|
||||
PackageSymbol p = myPackages.get(qualifiedName);
|
||||
if (p == null) {
|
||||
PackageSymbol owner = enterPackage(myNameEnvironment.prefixId(qualifiedName));
|
||||
int shortName = myNameEnvironment.shortName(qualifiedName);
|
||||
p = new PackageSymbol(owner, qualifiedName, shortName);
|
||||
myPackages.put(qualifiedName, p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user