Search in sources :

Example 1 with Modular

use of org.elixir_lang.structure_view.element.modular.Modular in project intellij-elixir by KronicDeth.

the class GotoSymbolContributor method getItemsFromCallback.

private void getItemsFromCallback(@NotNull List<NavigationItem> items, @NotNull EnclosingModularByCall enclosingModularByCall, @NotNull Call call) {
    Modular modular = enclosingModularByCall.putNew(call);
    if (modular != null) {
        Callback callback = new Callback(modular, call);
        items.add(callback);
    } else {
        error("Cannot find enclosing Modular for Callback", call);
    }
}
Also used : Modular(org.elixir_lang.structure_view.element.modular.Modular)

Example 2 with Modular

use of org.elixir_lang.structure_view.element.modular.Modular in project intellij-elixir by KronicDeth.

the class GotoSymbolContributor method getItemsFromCallDefinitionSpecification.

private void getItemsFromCallDefinitionSpecification(@NotNull List<NavigationItem> items, @NotNull EnclosingModularByCall enclosingModularByCall, @NotNull Call call) {
    Modular modular = enclosingModularByCall.putNew(call);
    if (modular != null) {
        // pseudo-named-arguments
        boolean callback = false;
        Timed.Time time = Timed.Time.RUN;
        //noinspection ConstantConditions
        CallDefinitionSpecification callDefinitionSpecification = new CallDefinitionSpecification(modular, (AtUnqualifiedNoParenthesesCall) call, callback, time);
        items.add(callDefinitionSpecification);
    } else {
        error("Cannot find enclosing Modular for CallDefinitionSpecification", call);
    }
}
Also used : Modular(org.elixir_lang.structure_view.element.modular.Modular)

Example 3 with Modular

use of org.elixir_lang.structure_view.element.modular.Modular in project intellij-elixir by KronicDeth.

the class Quote method getChildren.

/**
     * Returns the list of children of the tree element.
     *
     * @return the list of children.
     */
@NotNull
@Override
public TreeElement[] getChildren() {
    Modular modular = modular();
    TreeElement[] children;
    if (modular != null) {
        children = Module.callChildren(modular, navigationItem);
    } else {
        children = new TreeElement[0];
    }
    return children;
}
Also used : Modular(org.elixir_lang.structure_view.element.modular.Modular) TreeElement(com.intellij.ide.util.treeView.smartTree.TreeElement) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with Modular

use of org.elixir_lang.structure_view.element.modular.Modular in project intellij-elixir by KronicDeth.

the class Quote method modular.

@Nullable
public Modular modular() {
    Modular modular = null;
    if (parent instanceof CallDefinitionClause) {
        CallDefinitionClause callDefinitionClause = (CallDefinitionClause) parent;
        modular = new org.elixir_lang.structure_view.element.modular.Quote(callDefinitionClause);
    } else if (parent instanceof Modular) {
        modular = (Modular) parent;
    }
    return modular;
}
Also used : Modular(org.elixir_lang.structure_view.element.modular.Modular) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with Modular

use of org.elixir_lang.structure_view.element.modular.Modular in project intellij-elixir by KronicDeth.

the class CallDefinition method fromCall.

/*
     * Constructors
     */
/**
     * @param call a def(macro)?p? call
     */
@Nullable
public static CallDefinition fromCall(@NotNull Call call) {
    Modular modular = CallDefinitionClause.enclosingModular(call);
    CallDefinition callDefinition = null;
    if (modular != null) {
        Pair<String, IntRange> nameArityRange = CallDefinitionClause.nameArityRange(call);
        if (nameArityRange != null) {
            String name = nameArityRange.first;
            /* arity is assumed to be max arity in the range because that's how {@code h} and ExDoc treat functions
                   with defaults. */
            int arity = nameArityRange.second.getMaximumInteger();
            Time time = CallDefinitionClause.time(call);
            callDefinition = new CallDefinition(modular, time, name, arity);
        }
    }
    return callDefinition;
}
Also used : IntRange(org.apache.commons.lang.math.IntRange) Modular(org.elixir_lang.structure_view.element.modular.Modular) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Modular (org.elixir_lang.structure_view.element.modular.Modular)11 Nullable (org.jetbrains.annotations.Nullable)3 IntRange (org.apache.commons.lang.math.IntRange)2 TreeElement (com.intellij.ide.util.treeView.smartTree.TreeElement)1 AtUnqualifiedNoParenthesesCall (org.elixir_lang.psi.AtUnqualifiedNoParenthesesCall)1 Call (org.elixir_lang.psi.call.Call)1 Implementation (org.elixir_lang.structure_view.element.modular.Implementation)1 Module (org.elixir_lang.structure_view.element.modular.Module)1 Protocol (org.elixir_lang.structure_view.element.modular.Protocol)1 NotNull (org.jetbrains.annotations.NotNull)1