1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-23 12:14:45 +03:00

sml: fix mlton self-host. Full syntax err in catch*

In mlton mode, syntax errors caught in the try/catch block were being
processed as "SyntaxError" without any additional context/message.
Explicitly pass the full message always.
This commit is contained in:
Joel Martin 2024-08-20 11:38:11 -05:00
parent a2973ab0b8
commit e9dd8c53e5
3 changed files with 3 additions and 0 deletions

View File

@ -71,6 +71,7 @@ and evalTry e [a, LIST ([SYMBOL "catch*", b, c],_)] = (eval e a handle ex => eva
and evalCatch e b ex body = eval (bind [b, exnVal ex] e) body
and exnVal (MalException x) = x
| exnVal (SyntaxError msg) = STRING msg
| exnVal (NotDefined msg) = STRING msg
| exnVal (NotApplicable msg) = STRING msg
| exnVal (OutOfBounds msg) = STRING msg

View File

@ -71,6 +71,7 @@ and evalTry e [a, LIST ([SYMBOL "catch*", b, c],_)] = (eval e a handle ex => eva
and evalCatch e b ex body = eval (bind [b, exnVal ex] e) body
and exnVal (MalException x) = x
| exnVal (SyntaxError msg) = STRING msg
| exnVal (NotDefined msg) = STRING msg
| exnVal (NotApplicable msg) = STRING msg
| exnVal (OutOfBounds msg) = STRING msg

View File

@ -41,6 +41,7 @@
(try* (map throw (list "my err")) (catch* exc exc))
;=>"my err"
;;
;; Testing builtin functions