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);
}
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations