andytill / andytill/erlyberly

Show argument names in function traces

Offen
#162 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement erlang help wanted java
Vorherrschende Sprache
Java
Sterne
700
Forks
45
PR-Merge-Kennzahlen
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](https://user-images.githubusercontent.com/213455/35703174-271e29ee-0793-11e8-8766-01f22a1f801f.png)

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`.

```erlang
-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.

```erlang
{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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.