andytill/erlyberly

Show argument names in function traces

Open

#162 geöffnet am 1. Feb. 2018

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (43 Forks)batch import
enhancementerlanghelp wantedjava

Repository-Metriken

Stars
 (686 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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.

image

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.

-spec sublist(List1, Start, Len) -> List2 when
      List1 :: [T],
      List2 :: [T],
      Start :: pos_integer(),
      Len :: non_neg_integer(),
      T :: term().

sublist(List, S, L) when is_integer(L), L >= 0 ->

The function may return something like.

{lists, [{sublist,["List","S","L"],...}]}

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 than 0 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

Contributor Guide