use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class PerlMooseInnerReference method collectNamespaceMethodsAugmentations.
protected void collectNamespaceMethodsAugmentations(@NotNull PerlNamespaceDefinitionElement namespaceDefinition, @NotNull String subName, Set<PerlNamespaceDefinitionElement> recursionSet, List<ResolveResult> result) {
recursionSet.add(namespaceDefinition);
for (PerlNamespaceDefinitionElement childNamespace : namespaceDefinition.getChildNamespaceDefinitions()) {
if (!recursionSet.contains(childNamespace)) {
boolean noSubclasses = false;
for (PsiElement augmentStatement : getAugmentStatements(childNamespace)) {
if (subName.equals(((PerlMooseAugmentStatement) augmentStatement).getSubName())) {
result.add(new PsiElementResolveResult(augmentStatement));
noSubclasses = true;
}
}
if (!noSubclasses) {
collectNamespaceMethodsAugmentations(childNamespace, subName, recursionSet, result);
}
}
}
}
use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class packageProcessorsTest method testModernPerl.
public void testModernPerl() {
initWithFileSmart("ModernPerl");
PerlNamespaceDefinitionElement namespaceDefinition = getElementAtCaret(PerlNamespaceDefinitionElement.class);
assertNotNull(namespaceDefinition);
assertEquals(PerlMroType.C3, namespaceDefinition.getMroType());
PerlUseStatement useStatement = getElementAtCaret(PerlUseStatement.class);
assertNotNull(useStatement);
PerlPackageProcessor packageProcessor = useStatement.getPackageProcessor();
assertNotNull(packageProcessor);
assertInstanceOf(packageProcessor, PerlStrictProvider.class);
assertInstanceOf(packageProcessor, PerlMroProvider.class);
assertInstanceOf(packageProcessor, PerlWarningsProvider.class);
assertInstanceOf(packageProcessor, PerlPackageLoader.class);
}
use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class PerlPackageUtil method processNotOverridedMethods.
public static void processNotOverridedMethods(final PerlNamespaceDefinitionElement namespaceDefinition, Processor<PerlSubElement> processor) {
if (namespaceDefinition != null) {
PsiFile containingFile = namespaceDefinition.getContainingFile();
String packageName = namespaceDefinition.getPackageName();
if (packageName == null) {
return;
}
Set<String> namesSet = new THashSet<>();
// collecting overrided
for (PerlSubDefinitionElement subDefinitionBase : PsiTreeUtil.findChildrenOfType(containingFile, PerlSubDefinitionElement.class)) {
if (subDefinitionBase.isValid() && StringUtil.equals(packageName, subDefinitionBase.getPackageName())) {
namesSet.add(subDefinitionBase.getSubName());
}
}
processParentClassesSubs(namespaceDefinition, namesSet, new THashSet<>(), processor);
}
}
use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class PerlScalarUtil method getImportedScalarsDescritptors.
/**
* Returns a map of imported scalars names
*
* @param namespaceDefinitionElement element to start looking from
* @return result map
*/
@NotNull
public static List<PerlExportDescriptor> getImportedScalarsDescritptors(@NotNull PerlNamespaceDefinitionElement namespaceDefinitionElement) {
PerlImportsCollector collector = new PerlScalarImportsCollector();
PerlUtil.processImportedEntities(namespaceDefinitionElement, collector);
return collector.getResult();
}
use of com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement in project Perl5-IDEA by Camelcade.
the class PerlSubUtil method getImportedSubsDescriptors.
/**
* Returns a list of imported descriptors
*
* @param namespaceDefinitionElement element to start looking from
* @return result map
*/
@NotNull
public static List<PerlExportDescriptor> getImportedSubsDescriptors(@NotNull PerlNamespaceDefinitionElement namespaceDefinitionElement) {
PerlImportsCollector collector = new PerlSubImportsCollector();
PerlUtil.processImportedEntities(namespaceDefinitionElement, collector);
return collector.getResult();
}
Aggregations