use of com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceDefinitionStub in project Perl5-IDEA by Camelcade.
the class MasonNamespaceDefinitionImpl method getParentNamespaceDefinitions.
@Override
public List<PerlNamespaceDefinitionElement> getParentNamespaceDefinitions() {
List<String> parentsPaths;
PerlNamespaceDefinitionStub stub = getStub();
if (stub != null) {
parentsPaths = stub.getParentNamespacesNames();
} else {
parentsPaths = getParentNamespacesNamesFromPsi();
}
VirtualFile containingFile = MasonCoreUtil.getContainingVirtualFile(getContainingFile());
List<PerlNamespaceDefinitionElement> parentsNamespaces;
if (!parentsPaths.isEmpty() && containingFile != null) {
parentsNamespaces = Mason2Util.collectComponentNamespacesByPaths(getProject(), parentsPaths, containingFile.getParent());
} else {
String autobaseParent = getParentNamespaceFromAutobase();
if (autobaseParent != null) {
parentsNamespaces = Mason2Util.getMasonNamespacesByAbsolutePath(getProject(), autobaseParent);
} else {
parentsNamespaces = new ArrayList<>();
}
}
if (parentsNamespaces.isEmpty()) {
parentsNamespaces.addAll(PerlPackageUtil.getNamespaceDefinitions(getProject(), MASON_DEFAULT_COMPONENT_PARENT));
}
return parentsNamespaces;
}
use of com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceDefinitionStub in project Perl5-IDEA by Camelcade.
the class PerlNamespaceDefinitionElementType method deserialize.
@NotNull
@Override
public PerlNamespaceDefinitionStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
String packageName = PerlStubSerializationUtil.readString(dataStream);
PerlMroType mroType = PerlMroType.valueOf(PerlStubSerializationUtil.readString(dataStream));
List<String> parentNamespaces = PerlStubSerializationUtil.readStringsList(dataStream);
List<String> EXPORT = PerlStubSerializationUtil.readStringsList(dataStream);
List<String> EXPORT_OK = PerlStubSerializationUtil.readStringsList(dataStream);
Map<String, List<String>> EXPORT_TAGS = PerlStubSerializationUtil.readStringListMap(dataStream);
assert packageName != null;
assert parentNamespaces != null;
assert EXPORT != null;
assert EXPORT_OK != null;
return createStubElement(parentStub, packageName, mroType, parentNamespaces, EXPORT, EXPORT_OK, EXPORT_TAGS, desearializeAnnotations(dataStream));
}
use of com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceDefinitionStub in project Perl5-IDEA by Camelcade.
the class PerlNamespaceDefinitionElementType method serialize.
@Override
public void serialize(@NotNull PerlNamespaceDefinitionStub stub, @NotNull StubOutputStream dataStream) throws IOException {
dataStream.writeName(stub.getPackageName());
dataStream.writeName(stub.getMroType().toString());
PerlStubSerializationUtil.writeStringsList(dataStream, stub.getParentNamespacesNames());
PerlStubSerializationUtil.writeStringsList(dataStream, stub.getEXPORT());
PerlStubSerializationUtil.writeStringsList(dataStream, stub.getEXPORT_OK());
PerlStubSerializationUtil.writeStringListMap(dataStream, stub.getEXPORT_TAGS());
PerlNamespaceAnnotations namespaceAnnotations = stub.getAnnotations();
if (namespaceAnnotations == null) {
dataStream.writeBoolean(false);
} else {
dataStream.writeBoolean(true);
namespaceAnnotations.serialize(dataStream);
}
}
use of com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceDefinitionStub in project Perl5-IDEA by Camelcade.
the class PerlNamespaceDefinitionMixin method getMroType.
@Override
public PerlMroType getMroType() {
PerlNamespaceDefinitionStub stub = getStub();
if (stub != null) {
return stub.getMroType();
}
if (mroTypeCache == null) {
MroSearcher searcher = new MroSearcher();
PerlPsiUtil.processNamespaceStatements(this, searcher);
mroTypeCache = searcher.getResult();
}
return mroTypeCache;
}
Aggregations