use of com.ericsson.otp.erlang.OtpErlangObject in project intellij-elixir by KronicDeth.
the class BreakpointReachedEvent method getStack.
@Nullable
private static List<ElixirTraceElement> getStack(@Nullable OtpErlangList traceElementsList) {
if (traceElementsList == null)
return null;
List<ElixirTraceElement> stack = new ArrayList<>(traceElementsList.arity());
for (OtpErlangObject traceElementObject : traceElementsList) {
OtpErlangTuple traceElementTuple = getTupleValue(traceElementObject);
// ignoring SP at 0
OtpErlangTuple moduleFunctionArgsTuple = getTupleValue(elementAt(traceElementTuple, 1));
OtpErlangList bindingsList = getListValue(elementAt(traceElementTuple, 2));
OtpErlangTuple fileLineTuple = getTupleValue(elementAt(traceElementTuple, 3));
String file = getStringText(elementAt(fileLineTuple, 0));
Integer line = getIntegerValue(elementAt(fileLineTuple, 1));
ElixirTraceElement traceElement = getTraceElement(moduleFunctionArgsTuple, bindingsList, file, line);
if (traceElement == null)
return null;
stack.add(traceElement);
}
return stack;
}
use of com.ericsson.otp.erlang.OtpErlangObject in project intellij-elixir by KronicDeth.
the class Import method keywordValueToArity.
@Nullable
private static Integer keywordValueToArity(@NotNull final Quotable keywordValue) {
OtpErlangObject quotedKeywordValue = keywordValue.quote();
Integer arity = null;
if (quotedKeywordValue instanceof OtpErlangLong) {
OtpErlangLong quotedKeywordValueLong = (OtpErlangLong) quotedKeywordValue;
try {
arity = quotedKeywordValueLong.intValue();
} catch (OtpErlangRangeException e) {
Logger.error(Import.class, "Arity in OtpErlangLong could not be downcast to an int", keywordValue);
}
}
return arity;
}
Aggregations