use of com.intellij.psi.impl.java.stubs.impl.PsiFieldStubImpl in project intellij-community by JetBrains.
the class JavaFieldStubElementType method deserialize.
@NotNull
@Override
public PsiFieldStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
StringRef name = dataStream.readName();
TypeInfo type = TypeInfo.readTYPE(dataStream);
StringRef initializerText = dataStream.readName();
byte flags = dataStream.readByte();
return new PsiFieldStubImpl(parentStub, StringRef.toString(name), type, StringRef.toString(initializerText), flags);
}
use of com.intellij.psi.impl.java.stubs.impl.PsiFieldStubImpl in project intellij-community by JetBrains.
the class JavaFieldStubElementType method createStub.
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
boolean isDeprecatedByComment = false;
boolean hasDeprecatedAnnotation = false;
boolean hasDocComment = false;
String name = null;
String initializer = null;
boolean expectingInit = false;
for (final LighterASTNode child : tree.getChildren(node)) {
final IElementType type = child.getTokenType();
if (type == JavaDocElementType.DOC_COMMENT) {
hasDocComment = true;
isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
} else if (type == JavaElementType.MODIFIER_LIST) {
hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
} else if (type == JavaTokenType.IDENTIFIER) {
name = RecordUtil.intern(tree.getCharTable(), child);
} else if (type == JavaTokenType.EQ) {
expectingInit = true;
} else if (expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type != JavaTokenType.SEMICOLON) {
initializer = encodeInitializer(tree, child);
break;
}
}
final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);
return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
Aggregations