File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -4439,6 +4439,7 @@ def record_each(obj: Object) -> Object:
4439
4439
"(" ++ (compile arg) ++ " => " ++ (compile body) ++ ")"
4440
4440
| {type="Apply", func=func, arg=arg} -> "(" ++ (compile func) ++ ")(" ++ (compile arg) ++ ")"
4441
4441
| {type="MatchFunction", cases=cases} ->
4442
+ -- TODO(max): Figure out what to do about __arg. Gensym?
4442
4443
(foldr (case -> acc -> (compile_case case) ++ "\n " ++ acc)
4443
4444
"raise 'no matching cases';"
4444
4445
cases
@@ -4447,6 +4448,12 @@ def record_each(obj: Object) -> Object:
4447
4448
"if (__arg === " ++ ($$int_as_str value) ++ ") { return " ++ (compile body) ++ "; }"
4448
4449
| {type="MatchCase", pattern={type="String", value=value}, body=body} ->
4449
4450
"if (__arg === " ++ ($$str_as_str value) ++ ") { return " ++ (compile body) ++ "; }"
4451
+ | {type="MatchCase", pattern={type="Var", name=name}, body=body} ->
4452
+ "return (" ++ compile ({type="Where",
4453
+ binding={type="Assign",
4454
+ name={type="Var", name=name},
4455
+ value={type="Var", name="__arg"}},
4456
+ body=body}) ++ ");"
4450
4457
)
4451
4458
4452
4459
. join = sep ->
You can’t perform that action at this time.
0 commit comments