Skip to content

Commit 93c341e

Browse files
committed
fixed bug in defslot code and improved performance
1 parent d9bba7e commit 93c341e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/matchers.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,14 @@ function defslot_term_matcher_constructor(term, acSets)
200200

201201
function defslot_term_matcher(success, data, bindings)
202202
!islist(data) && return nothing # if data is not a list, return nothing
203-
result = normal_matcher(success, data, bindings)
204-
result !== nothing && return result
203+
# call the normal mathcer, with succes function foo1 that simply returns the bindings
204+
# <--foo1-->
205+
result = normal_matcher((b,n) -> b, data, bindings)
206+
result !== nothing && return success(result, 1)
205207
# if no match, try to match with a defslot.
206-
# checks whether it matches the normal part if yes executes (foo)
207-
# (foo): adds the pair (default value name, default value) to the found bindings
208-
# <------------------(foo)---------------------------->
208+
# checks whether it matches the normal part if yes executes foo2
209+
# foo2: adds the pair (default value name, default value) to the found bindings
210+
# <-------------------foo2---------------------------->
209211
result = other_part_matcher((b,n) -> assoc(b, defslot.name, defslot.defaultValue), data, bindings)
210212
result !== nothing && return success(result, 1)
211213
nothing

0 commit comments

Comments
 (0)