Repository navigation
Commit bd640ca
committed
fix(elixir): Phoenix channel extraction was unreachable in both branches
Neither half of extract_channels_elixir could ever fire, so an Elixir project
produced zero Channel nodes regardless of how much Phoenix.PubSub or
Phoenix.Channel it used.
The emit side read ts_node_child_by_field_name(call, "arguments").
tree-sitter-elixir defines no such field — its whole field set is key, left,
operand, operator, quoted_start, quoted_end, right, target and value — so args
was always null and elixir_emit_second_arg() returned early every time.
extract_defs.c has always used a positional second-child fallback for this;
the same fallback is now used here.
The listener side dispatched on strcmp(kind, "def"). There is no `def` node
type in the grammar: an Elixir definition is a `call` whose target is the macro
name. elixir_process_function_def() was therefore dead code, and it also read
`name` and `parameters` fields that do not exist. It now takes the def call,
unwraps a `when` guard, and reads the head's name and parameters positionally,
so guarded clauses like `def handle_in(e, p, s) when is_map(s)` are recognized
too.
Verified against a Phoenix application; the new test covers
Phoenix.PubSub.broadcast/subscribe, a bare push/broadcast emit, and two
handle_in clauses, one of them guarded.
Signed-off-by: Henry Hazan <henry@teramine.io>1 parent 46ae198 commit bd640ca
2 files changed
Lines changed: 123 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
901 | 901 | | |
902 | 902 | | |
903 | 903 | | |
904 | | - | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
905 | 920 | | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
906 | 940 | | |
907 | 941 | | |
908 | 942 | | |
| |||
911 | 945 | | |
912 | 946 | | |
913 | 947 | | |
914 | | - | |
| 948 | + | |
915 | 949 | | |
916 | 950 | | |
917 | 951 | | |
| |||
927 | 961 | | |
928 | 962 | | |
929 | 963 | | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
934 | 989 | | |
935 | 990 | | |
936 | 991 | | |
937 | 992 | | |
938 | 993 | | |
939 | 994 | | |
940 | 995 | | |
941 | | - | |
| 996 | + | |
942 | 997 | | |
943 | 998 | | |
944 | 999 | | |
| |||
952 | 1007 | | |
953 | 1008 | | |
954 | 1009 | | |
955 | | - | |
| 1010 | + | |
956 | 1011 | | |
957 | 1012 | | |
958 | 1013 | | |
| |||
964 | 1019 | | |
965 | 1020 | | |
966 | 1021 | | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
967 | 1025 | | |
968 | | - | |
969 | | - | |
970 | | - | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
971 | 1034 | | |
972 | 1035 | | |
973 | 1036 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1005 | 1005 | | |
1006 | 1006 | | |
1007 | 1007 | | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
1008 | 1056 | | |
1009 | 1057 | | |
1010 | 1058 | | |
| |||
5432 | 5480 | | |
5433 | 5481 | | |
5434 | 5482 | | |
| 5483 | + | |
5435 | 5484 | | |
5436 | 5485 | | |
5437 | 5486 | | |
| |||
0 commit comments