Przeglądaj źródła

Added default error message for empty locations

Taddeus Kroes 12 lat temu
rodzic
commit
93c0a8b5cc
1 zmienionych plików z 5 dodań i 0 usunięć
  1. 5 0
      main.ml

+ 5 - 0
main.ml

@@ -103,6 +103,11 @@ let main () =
         | InvalidInput name ->
             raise (CompileError ("invalid input for phase \"" ^ name ^ "\""))
         | NodeError (node, msg) ->
+            (* If no location is given, just stringify the node to at least give
+             * some information *)
+            let msg = if locof node = noloc then
+                msg ^ "\nnode: " ^ Stringify.node2str node
+            else msg in
             raise (LocError (locof node, msg))
     with
     | CompileError msg ->