Explorar el Código

Added default error message for empty locations

Taddeus Kroes hace 12 años
padre
commit
93c0a8b5cc
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  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 ->