From 1841915d9216d73d5636e7ec4060018d4825bbf9 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Fri, 14 Jun 2024 16:52:07 -0400 Subject: [PATCH] fix? bug in call-fn with incorrect function call info --- src/interpreter.janet | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interpreter.janet b/src/interpreter.janet index 4f2b095..e040e40 100644 --- a/src/interpreter.janet +++ b/src/interpreter.janet @@ -423,8 +423,8 @@ (when (= :function (type clauses)) (break (clauses root-ast ;args))) (def len (length clauses)) - (when (the-fn :match) (break ((the-fn :match) 0 args))) - (defn match-fn [i args] + (when (the-fn :match) (break ((the-fn :match) root-ast 0 args))) + (defn match-fn [root-ast i args] (when (= len i) (error {:node root-ast :called the-fn :value args :msg "no match: function call"})) (def clause (clauses i)) @@ -432,17 +432,17 @@ (def match? (match-pattern patt args @{:^parent (the-fn :ctx)})) (when (not (match? :success)) - (break (match-fn (inc i) args))) + (break (match-fn root-ast (inc i) args))) # (print "matched!") (def body-ctx (match? :ctx)) (def guard? (if guard (b/bool (interpret guard body-ctx)) true)) # (print "passed guard") (when (not guard?) - (break (match-fn (inc i) args))) + (break (match-fn root-ast (inc i) args))) (interpret expr body-ctx)) (set (the-fn :match) match-fn) - (match-fn 0 args)) + (match-fn root-ast 0 args)) (set call-fn call-fn*)