Skip to content

Commit

Permalink
CLJS-328: fix :require spec handling in ns
Browse files Browse the repository at this point in the history
Fixes singleton vector handling in :require specs so that all specs in
the following snippet are equivalent:

(ns foo
  (:require [bar.quux :as bar.quux]
            [bar.quux]
            bar.quux))
  • Loading branch information
michalmarczyk authored and David Nolen committed Jun 29, 2012
1 parent c60df78 commit 8365d2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/clj/cljs/analyzer.clj
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -606,9 +606,9 @@
(<= (fs :refer 0) 1))) (<= (fs :refer 0) 1)))
(error-msg spec "Each of :as and :refer options may only be specified once in :require / :require-macros"))) (error-msg spec "Each of :as and :refer options may only be specified once in :require / :require-macros")))
(if (symbol? spec) (if (symbol? spec)
(recur macros? [spec :as spec]) (recur macros? [spec])
(let [[lib & opts] spec (let [[lib & opts] spec
{alias :as referred :refer} (apply hash-map opts) {alias :as referred :refer :or {alias lib}} (apply hash-map opts)
[rk uk] (if macros? [:require-macros :use-macros] [:require :use])] [rk uk] (if macros? [:require-macros :use-macros] [:require :use])]
(assert (or (symbol? alias) (nil? alias)) (assert (or (symbol? alias) (nil? alias))
(error-msg spec ":as must be followed by a symbol in :require / :require-macros")) (error-msg spec ":as must be followed by a symbol in :require / :require-macros"))
Expand Down

0 comments on commit 8365d2a

Please sign in to comment.