Don't set a handler function name as an identifier.

This commit is contained in:
Eitaro Fukamachi 2014-10-24 14:01:04 +09:00
parent a15c72ebd5
commit f4d00bc0a6
2 changed files with 2 additions and 23 deletions

View file

@ -11,8 +11,6 @@
(:import-from :myway.route
:route
:make-route)
(:import-from :myway.util
:function-name)
(:export :make-mapper
:connect
:next-route
@ -28,8 +26,7 @@
:make-route))
(in-package :myway)
(defun connect (mapper url fn &key (method '(:GET)) regexp (name (when (functionp fn)
(function-name fn))))
(defun connect (mapper url fn &key (method '(:GET)) regexp name)
(add-route mapper
(make-route url
:method method

View file

@ -3,8 +3,7 @@
(:use :cl)
(:import-from :cl-utilities
:with-collectors)
(:export :make-collector
:function-name))
(:export :make-collector))
(in-package :myway.util)
(defun make-collector ()
@ -16,20 +15,3 @@
(unless (eq data none)
(buffer data))
buffer)))))
(defun function-name (fn)
(when (symbolp fn)
(return-from function-name fn))
#+ccl (ccl:function-name fn)
#-ccl
(multiple-value-bind (lambda closurep name) (function-lambda-expression fn)
(declare (ignore closurep))
(cond
(lambda nil)
((and (listp name)
(or (eq (car name) 'labels)
(eq (car name) 'flet)))
(cadr name))
((and (listp name)
(eq (car name) 'lambda)) nil)
(T name))))