Permalink
Browse files

import-fn -> import-macro

  • Loading branch information...
ztellman committed Apr 22, 2012
1 parent f2e2628 commit 8649792648a2dfc5612f8bb44f88d6c872fe41e8
Showing with 8 additions and 2 deletions.
  1. +1 −1 src/potemkin.clj
  2. +4 −0 src/potemkin/namespace.clj
  3. +3 −1 src/potemkin/protocols.clj
View
@@ -22,7 +22,7 @@
(import-fn macros/transform-defn-bodies)
(import-fn macros/transform-fn-bodies)
-(import-fn protocols/defprotocol-once)
+(import-macro protocols/defprotocol-once)
@@ -22,6 +22,8 @@
protocol (:protocol m)]
(when-not vr
(throw (IllegalArgumentException. (str "Don't recognize " sym))))
+ (when (:macro m)
+ (throw (IllegalArgumentException. (str "Calling import-fn on a macro: " sym))))
`(do
(def ~(with-meta n {:protocol protocol}) (deref ~vr))
(alter-meta! (var ~n) assoc
@@ -43,6 +45,8 @@
doc (:doc m)]
(when-not vr
(throw (IllegalArgumentException. (str "Don't recognize " sym))))
+ (when-not (:macro m)
+ (throw (IllegalArgumentException. (str "Calling import-macro on a non-macro: " sym))))
`(do
(def ~n ~(resolve sym))
(alter-meta! (var ~n) assoc
@@ -8,7 +8,9 @@
(ns potemkin.protocols)
-(defmacro defprotocol-once [name & body]
+(defmacro defprotocol-once
+ "defonce for defprotocol"
+ [name & body]
(if (resolve name)
`(do)
(list* 'defprotocol name body)))

0 comments on commit 8649792

Please sign in to comment.