Skip to content

Commit aee0635

Browse files
committed
fixed bug on defslot functionality
1 parent b578edd commit aee0635

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/matchers.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ function matcher(val::Any)
1313
# just two arguments bc defslot is only supported with operations with two args: *, ^, +
1414
if length(arguments(val)) == 2 && any(x -> isa(x, DefSlot), arguments(val))
1515
return defslot_term_matcher_constructor(val)
16-
# else return a normal term matcher
17-
else
18-
return term_matcher_constructor(val)
1916
end
17+
# else return a normal term matcher
18+
return term_matcher_constructor(val)
2019
end
2120

2221
function literal_matcher(next, data, bindings)
@@ -232,6 +231,7 @@ function defslot_term_matcher_constructor(term)
232231
normal_matcher = term_matcher_constructor(term)
233232

234233
function defslot_term_matcher(success, data, bindings)
234+
!islist(data) && return nothing # if data is not a list, return nothing
235235
result = normal_matcher(success, data, bindings)
236236
result !== nothing && return result
237237
# if no match, try to match with a defslot

0 commit comments

Comments
 (0)