use of org.elixir_lang.psi.operation.InMatch in project intellij-elixir by KronicDeth.
the class Variable method enclosingMatch.
@Contract(pure = true)
@NotNull
private PsiElement enclosingMatch(@NotNull final PsiElement ancestor) {
PsiElement enclosingMatch = ancestor;
PsiElement parent = ancestor.getParent();
if (parent instanceof InMatch || parent instanceof Match) {
enclosingMatch = parent;
} else {
assert ancestor != null;
}
return enclosingMatch;
}
use of org.elixir_lang.psi.operation.InMatch in project intellij-elixir by KronicDeth.
the class Parameter method putParameterized.
@Contract(pure = true)
@NotNull
private static Parameter putParameterized(@NotNull final Parameter parameter, @NotNull final PsiElement ancestor) {
Parameter parameterizedParameter;
PsiElement parent = ancestor.getParent();
/* MUST be before `Call` because `When` operations are `Call` implementations too in all cases even though
`When` is not a subinterface. */
if (parent instanceof When) {
parameterizedParameter = putParameterized(parameter, parent);
} else if (parent instanceof Call) {
parameterizedParameter = putParameterized(parameter, (Call) parent);
} else if (parent instanceof AtNonNumericOperation || parent instanceof ElixirAccessExpression || parent instanceof ElixirAssociations || parent instanceof ElixirAssociationsBase || parent instanceof ElixirBitString || parent instanceof ElixirBracketArguments || parent instanceof ElixirContainerAssociationOperation || parent instanceof ElixirKeywordPair || parent instanceof ElixirKeywords || parent instanceof ElixirList || parent instanceof ElixirMapArguments || parent instanceof ElixirMapConstructionArguments || parent instanceof ElixirMapOperation || parent instanceof ElixirMatchedParenthesesArguments || parent instanceof ElixirNoParenthesesArguments || parent instanceof ElixirNoParenthesesKeywordPair || parent instanceof ElixirNoParenthesesKeywords || /* ElixirNoParenthesesManyStrictNoParenthesesExpression indicates a syntax error where no parentheses
calls are nested, so it's invalid, but try to still resolve parameters to have highlighting */
parent instanceof ElixirNoParenthesesManyStrictNoParenthesesExpression || parent instanceof ElixirNoParenthesesOneArgument || /* handles `(conn, %{})` in `def (conn, %{})`, which can occur in def templates.
See https://github.com/KronicDeth/intellij-elixir/issues/367#issuecomment-244214975 */
parent instanceof ElixirNoParenthesesStrict || parent instanceof ElixirParenthesesArguments || parent instanceof ElixirParentheticalStab || parent instanceof ElixirStab || parent instanceof ElixirStabNoParenthesesSignature || parent instanceof ElixirStabBody || parent instanceof ElixirStabOperation || parent instanceof ElixirStabParenthesesSignature || parent instanceof ElixirStructOperation || parent instanceof ElixirTuple) {
parameterizedParameter = putParameterized(parameter, parent);
} else if (parent instanceof ElixirAnonymousFunction) {
parameterizedParameter = putParameterized(parameter, (ElixirAnonymousFunction) parent);
} else if (parent instanceof InMatch) {
parameterizedParameter = putParameterized(parameter, (InMatch) parent);
} else if (parent instanceof BracketOperation || parent instanceof ElixirBlockItem || parent instanceof ElixirDoBlock || parent instanceof ElixirInterpolation || parent instanceof ElixirMapUpdateArguments || parent instanceof ElixirMultipleAliases || parent instanceof ElixirQuoteStringBody || parent instanceof PsiFile || parent instanceof QualifiedAlias || parent instanceof QualifiedMultipleAliases) {
parameterizedParameter = new Parameter(parameter.entrance);
} else {
error("Don't know how to check if parameter", parent);
parameterizedParameter = new Parameter(parameter.entrance);
}
return parameterizedParameter;
}
Aggregations