Search in sources :

Example 1 with HTMLMasonFlagsStatementStub

use of com.perl5.lang.htmlmason.parser.stubs.HTMLMasonFlagsStatementStub in project Perl5-IDEA by Camelcade.

the class HTMLMasonFlagsStatementImpl method getParentComponentPath.

@Nullable
@Override
public String getParentComponentPath() {
    HTMLMasonFlagsStatementStub stub = getStub();
    if (stub != null) {
        return stub.getParentComponentPath();
    }
    PsiPerlCommaSequenceExpr expr = PsiTreeUtil.findChildOfType(this, PsiPerlCommaSequenceExpr.class);
    if (expr != null) {
        PsiElement firstChild = expr.getFirstChild();
        PsiElement lastChild = expr.getLastChild();
        if (firstChild instanceof PerlString && StringUtil.equals("inherit", ElementManipulators.getValueText(firstChild)) && lastChild instanceof PerlString) {
            return ElementManipulators.getValueText(lastChild);
        }
    }
    return UNDEF_RESULT;
}
Also used : PerlString(com.perl5.lang.perl.psi.PerlString) HTMLMasonFlagsStatementStub(com.perl5.lang.htmlmason.parser.stubs.HTMLMasonFlagsStatementStub) PsiPerlCommaSequenceExpr(com.perl5.lang.perl.psi.PsiPerlCommaSequenceExpr) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 HTMLMasonFlagsStatementStub (com.perl5.lang.htmlmason.parser.stubs.HTMLMasonFlagsStatementStub)1 PerlString (com.perl5.lang.perl.psi.PerlString)1 PsiPerlCommaSequenceExpr (com.perl5.lang.perl.psi.PsiPerlCommaSequenceExpr)1 Nullable (org.jetbrains.annotations.Nullable)1