Function: cl-typep--inliner

cl-typep--inliner is a function defined in cl-macs.el.gz.

Signature

(cl-typep--inliner INLINE--FORM VAL TYPE)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-macs.el.gz
;; Closure converted to defun by helpful.
(defun cl-typep--inliner
    (inline--form val type)
  (ignore inline--form)
  (catch 'inline--just-use
    (let*
	((exp val)
	 (val
	  (if
	      (macroexp-copyable-p exp)
	      exp
	    (make-symbol "val")))
	 (body
	  (let*
	      ((val
		(cond
		 ((not
		   (or
		    (macroexp-const-p type)
		    (eq
		     (car-safe type)
		     'function)))
		  (throw 'inline--just-use inline--form))
		 ((consp type)
		  (car
		   (cdr type)))
		 (t type))))
	    (cond
	     ((consp val)
	      (let*
		  ((x11620
		    (car-safe val))
		   (x11621
		    (cdr-safe val)))
		(cond
		 ((let*
		      ((name x11620))
		    (get name 'cl-deftype-handler))
		  (let
		      ((name x11620)
		       (args x11621))
		    (ignore name)
		    (list 'cl-typep val
			  (list 'quote
				(apply
				 (get name 'cl-deftype-handler)
				 args)))))
		 ((memq x11620
			'(number real float integer))
		  (ignore
		   (consp x11621))
		  (let*
		      ((x11622
			(car-safe x11621))
		       (x11623
			(cdr-safe x11621)))
		    (progn
		      (ignore
		       (consp x11623))
		      (let*
			  ((x11624
			    (car-safe x11623))
			   (x11625
			    (cdr-safe x11623)))
			(progn
			  (ignore
			   (null x11625))
			  (let
			      ((name x11620)
			       (min x11622)
			       (max x11624))
			    (list 'and
				  (list 'cl-typep val
					(list 'quote name))
				  (if
				      (memq min
					    '(* nil))
				      t
				    (if
					(consp min)
					(list '> val
					      (list 'quote
						    (car min)))
				      (list '>= val
					    (list 'quote min))))
				  (if
				      (memq max
					    '(* nil))
				      t
				    (if
					(consp max)
					(list '< val
					      (list 'quote
						    (car max)))
				      (list '<= val
					    (list 'quote max)))))))))))
		 ((eq x11620 'not)
		  (if
		      (consp x11621)
		      (let*
			  ((x11626
			    (car-safe x11621))
			   (x11627
			    (cdr-safe x11621)))
			(if
			    (null x11627)
			    (let
				((type x11626))
			      (list 'not
				    (list 'cl-typep val
					  (list 'quote type))))
			  (let
			      ((type val))
			    (error "Bad type spec: %S" type))))
		    (let
			((type val))
		      (error "Bad type spec: %S" type))))
		 ((memq x11620
			'(or and))
		  (let
		      ((name x11620)
		       (types x11621))
		    (cond
		     ((null types)
		      (list 'quote
			    (eq name 'and)))
		     ((null
		       (cdr types))
		      (list 'cl-typep val
			    (list 'quote
				  (car types))))
		     (t
		      (let
			  ((head
			    (car types))
			   (rest
			    (cons name
				  (cdr types))))
			(cond
			 ((eq name 'and)
			  (list 'and
				(list 'cl-typep val
				      (list 'quote head))
				(list 'cl-typep val
				      (list 'quote rest))))
			 (t
			  (list 'or
				(list 'cl-typep val
				      (list 'quote head))
				(list 'cl-typep val
				      (list 'quote rest))))))))))
		 ((eq x11620 'eql)
		  (if
		      (consp x11621)
		      (let*
			  ((x11628
			    (car-safe x11621))
			   (x11629
			    (cdr-safe x11621)))
			(if
			    (null x11629)
			    (let
				((v x11628))
			      (list 'and
				    (list 'eql val
					  (list 'quote v))
				    t))
			  (let
			      ((type val))
			    (error "Bad type spec: %S" type))))
		    (let
			((type val))
		      (error "Bad type spec: %S" type))))
		 ((eq x11620 'member)
		  (let
		      ((args x11621))
		    (list 'and
			  (list 'memql val
				(list 'quote args))
			  t)))
		 ((not
		   (eq x11620 'satisfies))
		  (let
		      ((type val))
		    (error "Bad type spec: %S" type)))
		 ((consp x11621)
		  (let*
		      ((x11630
			(car-safe x11621))
		       (x11631
			(cdr-safe x11621)))
		    (if
			(null x11631)
			(let
			    ((pred x11630))
			  (list 'funcall
				(list 'function pred)
				val))
		      (let
			  ((type val))
			(error "Bad type spec: %S" type)))))
		 (t
		  (let
		      ((type val))
		    (error "Bad type spec: %S" type))))))
	     ((not
	       (symbolp val))
	      (let
		  ((type val))
		(error "Bad type spec: %S" type)))
	     ((let*
		  ((type val))
		(get type 'cl-deftype-handler))
	      (let
		  ((type val))
		(ignore type)
		(list 'cl-typep val
		      (list 'quote
			    (funcall
			     (get type 'cl-deftype-handler))))))
	     ((let*
		  ((type val))
		(get type 'cl-deftype-satisfies))
	      (let
		  ((type val))
		(ignore type)
		(list 'funcall
		      (list 'function
			    (get type 'cl-deftype-satisfies))
		      val)))
	     ((memq val
		    '(t nil))
	      (let
		  ((type val))
		(list 'quote type)))
	     (t
	      (let
		  ((type val))
		(macroexp-warn-and-return
		 (format-message "Unknown type: %S" type)
		 (let*
		     ((name
		       (symbol-name type))
		      (namep
		       (intern
			(concat name "p"))))
		   (cond
		    ((cl--macroexp-fboundp namep)
		     (list 'funcall
			   (list 'function namep)
			   val))
		    ((cl--macroexp-fboundp
		      (setq namep
			    (intern
			     (concat name "-p"))))
		     (list 'funcall
			   (list 'function namep)
			   val))
		    ((cl--macroexp-fboundp type)
		     (list 'funcall
			   (list 'function type)
			   val))
		    (t
		     (error "Unknown type %S" type))))
		 nil nil type)))))))
      (if
	  (eq val exp)
	  body
	(macroexp-let*
	 (list
	  (list val exp))
	 body)))))