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:
44444444 "(" ++ (compile arg) ++ " => " ++ (compile body) ++ ")"
44454445 | {type="Apply", func=func, arg=arg} -> "(" ++ (compile func) ++ ")(" ++ (compile arg) ++ ")"
44464446 | {type="MatchFunction", cases=cases} ->
4447+ -- TODO(max): Figure out what to do about __arg. Gensym?
44474448 (foldr (case -> acc -> (compile_case case) ++ "\n " ++ acc)
44484449 "raise 'no matching cases';"
44494450 cases
@@ -4452,6 +4453,12 @@ def record_each(obj: Object) -> Object:
44524453 "if (__arg === " ++ ($$int_as_str value) ++ ") { return " ++ (compile body) ++ "; }"
44534454 | {type="MatchCase", pattern={type="String", value=value}, body=body} ->
44544455 "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}) ++ ");"
44554462 )
44564463
44574464. join = sep ->
You can’t perform that action at this time.
0 commit comments