0.9.2.25:
[sbcl.git] / src / compiler / target-main.lisp
index 6838041..a02797b 100644 (file)
             (*source-info* (make-lisp-source-info form))
             (*toplevel-lambdas* ())
             (*block-compile* nil)
+             (*allow-instrumenting* nil)
             (*compiler-error-bailout*
-             (lambda ()
+             (lambda (&optional error)
+                (declare (ignore error))
                (compiler-mumble
                 "~2&fatal error, aborting compilation~%")
                (return-from actually-compile (values nil t nil))))
             ;; call %COMPILE with a core-object, not a fasl-stream,
             ;; but caveat future maintainers. -- CSR, 2002-10-27
             (*policy* (lexenv-policy *lexenv*))
+            ;; see above
+            (*handled-conditions* (lexenv-handled-conditions *lexenv*))
+            ;; ditto
+            (*disabled-package-locks* (lexenv-disabled-package-locks *lexenv*))
             ;; FIXME: ANSI doesn't say anything about CL:COMPILE
             ;; interacting with these variables, so we shouldn't. As
             ;; of SBCL 0.6.7, COMPILE-FILE controls its verbosity by
             ;; controlled by function arguments and lexical variables.
             (*compile-verbose* nil)
             (*compile-print* nil))
-       (clear-stuff)
-       (find-source-paths form 0)
-       (%compile form (make-core-object)
-                 :name name
-                 :path '(original-source-start 0 0))))))
+       (handler-bind (((satisfies handle-condition-p) #'handle-condition-handler))
+         (clear-stuff)
+         (find-source-paths form 0)
+         (%compile form (make-core-object)
+                   :name name
+                   :path '(original-source-start 0 0)))))))
 
 (defun compile-in-lexenv (name definition lexenv)
   (multiple-value-bind (compiled-definition warnings-p failure-p)
   otherwise THING is NAME. When NAME is not NIL, the compiled function
   is also set into (MACRO-FUNCTION NAME) if NAME names a macro, or into
   (FDEFINITION NAME) otherwise."
-  (compile-in-lexenv name definition (make-null-lexenv)))
+  (multiple-value-bind (function warnings-p failure-p) 
+      (compile-in-lexenv name definition (make-null-lexenv))
+    (values (or function
+               name
+               (lambda (&rest arguments)
+                 (error 'simple-program-error
+                        :format-control 
+                        "Called function compiled with errors. Original ~
+                          definition:~%  ~S~@[~%Arguments:~% ~{ ~S~}~]"
+                        :format-arguments (list definition arguments))))
+           warnings-p
+           failure-p)))