Ver Fonte

Added default error message for empty locations

Taddeus Kroes há 12 anos atrás
pai
commit
93c0a8b5cc
1 ficheiros alterados com 5 adições e 0 exclusões
  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 ->