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 @@ -4444,6 +4444,7 @@ def record_each(obj: Object) -> Object:
4444
4444
"(" ++ (compile arg) ++ " => " ++ (compile body) ++ ")"
4445
4445
| {type="Apply", func=func, arg=arg} -> "(" ++ (compile func) ++ ")(" ++ (compile arg) ++ ")"
4446
4446
| {type="MatchFunction", cases=cases} ->
4447
+ -- TODO(max): Figure out what to do about __arg. Gensym?
4447
4448
(foldr (case -> acc -> (compile_case case) ++ "\n " ++ acc)
4448
4449
"raise 'no matching cases';"
4449
4450
cases
@@ -4452,6 +4453,12 @@ def record_each(obj: Object) -> Object:
4452
4453
"if (__arg === " ++ ($$int_as_str value) ++ ") { return " ++ (compile body) ++ "; }"
4453
4454
| {type="MatchCase", pattern={type="String", value=value}, body=body} ->
4454
4455
"if (__arg === " ++ ($$str_as_str value) ++ ") { return " ++ (compile body) ++ "; }"
4456
+ | {type="MatchCase", pattern={type="Var", name=name}, body=body} ->
4457
+ "return (" ++ compile ({type="Where",
4458
+ binding={type="Assign",
4459
+ name={type="Var", name=name},
4460
+ value={type="Var", name="__arg"}},
4461
+ body=body}) ++ ");"
4455
4462
)
4456
4463
4457
4464
. join = sep ->
You can’t perform that action at this time.
0 commit comments