Condition NO-APPLICABLE-CXX-METHOD
Wed May 27 19:47:28 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Condition NO-APPLICABLE-CXX-METHOD
diff -rN -u old-smoke/src/objects/stack.lisp new-smoke/src/objects/stack.lisp
--- old-smoke/src/objects/stack.lisp 2014-10-01 12:22:46.000000000 +0200
+++ new-smoke/src/objects/stack.lisp 2014-10-01 12:22:46.000000000 +0200
@@ -78,6 +78,7 @@
(0 (let ((cffi-type (get-type (name type))))
(if (null cffi-type)
(progn
+ ;; FIXME warn but not on void**
;;(warn "Unknown translation from ~A to lisp." (name type))
(foreign-slot-value stack-item 'smoke-stack-item 'voidp))
(let* ((pointer (foreign-slot-value stack-item
diff -rN -u old-smoke/src/overload-resolution.lisp new-smoke/src/overload-resolution.lisp
--- old-smoke/src/overload-resolution.lisp 2014-10-01 12:22:46.000000000 +0200
+++ new-smoke/src/overload-resolution.lisp 2014-10-01 12:22:46.000000000 +0200
@@ -455,6 +455,26 @@
(mapcar #'(lambda (conversion argument)
(funcall conversion argument))
sequence args)))
+
+(defun format-no-applicable-cxx-method (stream name class arguments)
+ (format stream
+ "No applicable method ~S of ~A for ~S.
+Candidtes are:~{~T~%~}."
+ name class arguments
+ (mapcar #'signature
+ (viable-functions name
+ (length arguments)
+ (smoke-class-of class)))))
+
+(define-condition no-applicable-cxx-method (error)
+ ((method :initarg :method :reader condition-method)
+ (class :initarg :class :reader condition-class)
+ (arguments :initarg :arguments :reader condition-arguments))
+ (:report (lambda (condition stream)
+ (format-no-applicable-cxx-method stream
+ (condition-method condition)
+ (condition-class condition)
+ (condition-arguments condition)))))
(defun call-using-args (object-or-class name arguments)
(declare (optimize (speed 3)))
@@ -469,13 +489,10 @@
arguments
(smoke-class-of object-or-class))
(when (null method)
- (error "No applicable method ~S of ~A for ~S.
-Candidates are:~{~T~A~%~}."
- name object-or-class arguments
- (mapcar #'signature
- (viable-functions name
- (length arguments)
- (smoke-class-of object-or-class)))))
+ (error (make-condition 'no-applicable-cxx-method
+ :method name
+ :class object-or-class
+ :arguments arguments)))
(if (static-p method)
(apply #'call-sequence method (null-pointer) sequence arguments)
(apply #'call-sequence method (cast object-or-class (get-class method))