use of com.ericsson.otp.erlang.OtpErlangList in project intellij-elixir by KronicDeth.
the class ModuleDefinition method name.
public String name() {
OtpErlangTuple quotedDefmodule = (OtpErlangTuple) defmodule.quote();
OtpErlangList callArguments = Macro.callArguments(quotedDefmodule);
// Alias + block
assert callArguments.arity() == 2;
OtpErlangObject quotedName = callArguments.elementAt(0);
// TODO handle other forms for module names
assert Macro.isAliases(quotedName);
return Macro.toString(quotedName);
}
use of com.ericsson.otp.erlang.OtpErlangList in project intellij-elixir by KronicDeth.
the class BreakpointReachedEvent method getTraceElement.
@Nullable
private static ElixirTraceElement getTraceElement(@Nullable OtpErlangTuple moduleFunctionArgsTuple, @Nullable OtpErlangList bindingsList, String file, Integer line) {
String moduleName = getAtomText(elementAt(moduleFunctionArgsTuple, 0));
String functionName = getAtomText(elementAt(moduleFunctionArgsTuple, 1));
OtpErlangList args = getListValue(elementAt(moduleFunctionArgsTuple, 2));
Collection<ElixirVariableBinding> bindings = getBindings(bindingsList);
// bindings are not necessarily present
if (moduleName == null || functionName == null || args == null)
return null;
return new ElixirTraceElement(moduleName, functionName, args, bindings, file, line);
}
use of com.ericsson.otp.erlang.OtpErlangList 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;
}
Aggregations