use of com.intellij.util.io.StringRef in project intellij-community by JetBrains.
the class PyTargetExpressionElementType method deserialize.
@NotNull
public PyTargetExpressionStub deserialize(@NotNull final StubInputStream stream, final StubElement parentStub) throws IOException {
String name = StringRef.toString(stream.readName());
String docString = stream.readUTFFast();
if (docString.isEmpty()) {
docString = null;
}
PyTargetExpressionStub.InitializerType initializerType = PyTargetExpressionStub.InitializerType.fromIndex(stream.readVarInt());
final StringRef typeCommentRef = stream.readName();
final String typeComment = typeCommentRef == null ? null : typeCommentRef.getString();
if (initializerType == PyTargetExpressionStub.InitializerType.Custom) {
final String typeName = stream.readName().getString();
for (CustomTargetExpressionStubType type : getCustomStubTypes()) {
if (type.getClass().getCanonicalName().equals(typeName)) {
CustomTargetExpressionStub stub = type.deserializeStub(stream);
return new PyTargetExpressionStubImpl(name, docString, typeComment, stub, parentStub);
}
}
throw new IOException("Unknown custom stub type " + typeName);
}
QualifiedName initializer = QualifiedName.deserialize(stream);
boolean isQualified = stream.readBoolean();
return new PyTargetExpressionStubImpl(name, docString, initializerType, initializer, isQualified, typeComment, parentStub);
}
use of com.intellij.util.io.StringRef in project kotlin by JetBrains.
the class IdeStubIndexService method deserializeFileStub.
@NotNull
@Override
public KotlinFileStub deserializeFileStub(@NotNull StubInputStream dataStream) throws IOException {
StringRef packageFqNameAsString = dataStream.readName();
boolean isScript = dataStream.readBoolean();
StringRef facadeSimpleName = dataStream.readName();
StringRef partSimpleName = dataStream.readName();
int numPartNames = dataStream.readInt();
List<StringRef> facadePartNames = new ArrayList<StringRef>();
for (int i = 0; i < numPartNames; ++i) {
StringRef partNameRef = dataStream.readName();
facadePartNames.add(partNameRef);
}
return new KotlinFileStubForIde(null, packageFqNameAsString, isScript, facadeSimpleName, partSimpleName, facadePartNames);
}
use of com.intellij.util.io.StringRef in project kotlin by JetBrains.
the class IdeStubIndexService method createFileStub.
@NotNull
@Override
public KotlinFileStub createFileStub(@NotNull KtFile file) {
StringRef packageFqName = StringRef.fromString(file.getPackageFqNameByTree().asString());
boolean isScript = file.isScriptByTree();
if (PackagePartClassUtils.fileHasTopLevelCallables(file)) {
JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(file);
StringRef facadeSimpleName = StringRef.fromString(fileClassInfo.getFacadeClassFqName().shortName().asString());
StringRef partSimpleName = StringRef.fromString(fileClassInfo.getFileClassFqName().shortName().asString());
return new KotlinFileStubForIde(file, packageFqName, isScript, facadeSimpleName, partSimpleName, null);
}
return new KotlinFileStubForIde(file, packageFqName, isScript, null, null, null);
}
use of com.intellij.util.io.StringRef in project kotlin by JetBrains.
the class IdeStubIndexService method serializeFileStub.
@Override
public void serializeFileStub(@NotNull KotlinFileStub stub, @NotNull StubOutputStream dataStream) throws IOException {
KotlinFileStubForIde fileStub = (KotlinFileStubForIde) stub;
dataStream.writeName(fileStub.getPackageFqName().asString());
dataStream.writeBoolean(fileStub.isScript());
dataStream.writeName(StringRef.toString(fileStub.getFacadeSimpleName()));
dataStream.writeName(StringRef.toString(fileStub.getPartSimpleName()));
List<StringRef> facadePartNames = fileStub.getFacadePartSimpleNames();
if (facadePartNames == null) {
dataStream.writeInt(0);
} else {
dataStream.writeInt(facadePartNames.size());
for (StringRef partName : facadePartNames) {
dataStream.writeName(StringRef.toString(partName));
}
}
}
use of com.intellij.util.io.StringRef in project intellij-community by JetBrains.
the class JavaClassElementType method deserialize.
@NotNull
@Override
public PsiClassStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
byte flags = dataStream.readByte();
boolean isAnonymous = PsiClassStubImpl.isAnonymous(flags);
boolean isEnumConst = PsiClassStubImpl.isEnumConstInitializer(flags);
JavaClassElementType type = typeForClass(isAnonymous, isEnumConst);
if (!isAnonymous) {
StringRef name = dataStream.readName();
StringRef qname = dataStream.readName();
StringRef sourceFileName = dataStream.readName();
PsiClassStubImpl classStub = new PsiClassStubImpl(type, parentStub, StringRef.toString(qname), StringRef.toString(name), null, flags);
classStub.setSourceFileName(StringRef.toString(sourceFileName));
return classStub;
} else {
StringRef baseRef = dataStream.readName();
return new PsiClassStubImpl(type, parentStub, null, null, StringRef.toString(baseRef), flags);
}
}
Aggregations