-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show argument names in function traces #162
Comments
So I have an initial results, I have yet to convert the params from their ast form. But in their lies the crux, we have complex params like process_info2 on line 79, size_to_bytes on line 118 and record fields on line 155. Here is a diff:
|
I can of course just extract the vars, if you want ;) |
Thanks @olafura! Yes the return should be a flat list of binding names, it is very difficult to take this apart in Java, like an untyped XML DOM. The function clause combinations do get very complex. In the example case we can get the binding names from the dialyzer spec initially, and then use the function clause to fill in the blanks. So for example, in this function. myfunc(0, Acc) -> Acc
myfunc(Index, _) -> myfunc(Index-1, 2). The list of returned arguments should be myfunc(0, Acc) -> Acc
myfunc(Index, X) -> myfunc(Index-1, X+1). Then we could return |
Erlyberly could show the names of function arguments above the values for function arguments in the term tree. Below is a screenshot of annotated records, it might look similar to this.
Module AST is already parsed for record metadata. Finding function argument names would be an expansion of that.
https://github.com/andytill/erlyberly/blob/master/src/main/resources/erlyberly/beam/erlyberly.erl#L172
For example, given the function in
lists
.The function may return something like.
The dialyzer spec can be used but it may not exist. Functions can have multiple clauses. A binding name should be accepted over
_
or a literal e.g.Index
is more useful than0
both of which may be present in different function clauses. There are many variations in function clauses, the AST parser should attempt to return something useful but could return a blank if the argument was too complex or long.If anyone wants to attempt this, post a comment. I can help with the UI for anyone that doesn't want to code java! :D
The text was updated successfully, but these errors were encountered: