Skip to content

Commit

Permalink
Upgrade tools.namespace.
Browse files Browse the repository at this point in the history
Closes #439
  • Loading branch information
vemv committed Aug 30, 2022
1 parent 58f50d3 commit caf8720
Show file tree
Hide file tree
Showing 30 changed files with 1,055 additions and 1,233 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@ pom.xml
.lein-repl-history
*~
/target/
/copy-deps-scripts/repos/
/.circleci/example-red-project/output
/.circleci/example-green-project/output
/.circleci/example-refresh-project/output
33 changes: 5 additions & 28 deletions README.md
Expand Up @@ -41,7 +41,7 @@ Eastwood can be run from the command line as a
Merge the following into your `project.clj` or `~/.lein/profiles.clj`:

```clojure
:plugins [[jonase/eastwood "1.2.4"]]
:plugins [[jonase/eastwood "1.2.5"]]
```

To run Eastwood with the default set of lint warnings on all of the
Expand All @@ -60,7 +60,7 @@ If you're using `deps.edn`, you can set Eastwood options in an edn map, like thi
"eastwood.lint"
;; Any Eastwood options can be passed here as edn:
{}]
:extra-deps {jonase/eastwood {:mvn/version "1.2.4"}}}}}
:extra-deps {jonase/eastwood {:mvn/version "1.2.5"}}}}}

```
to your `deps.edn`, and you should then be able to run Eastwood as
Expand Down Expand Up @@ -421,7 +421,7 @@ If you use Leiningen, merge this into your project's `project.clj`
file first:

```clojure
:profiles {:dev {:dependencies [[jonase/eastwood "1.2.4" :exclusions [org.clojure/clojure]]]}}
:profiles {:dev {:dependencies [[jonase/eastwood "1.2.5" :exclusions [org.clojure/clojure]]]}}
```

If you use a different build tool, you will need to add the dependency
Expand Down Expand Up @@ -564,7 +564,7 @@ can be used to modify this merging behavior.
For example, if your user-wide `profiles.clj` file contains this:

```clojure
{:user {:plugins [[jonase/eastwood "1.2.4"]]
{:user {:plugins [[jonase/eastwood "1.2.5"]]
:eastwood {:exclude-linters [:unlimited-use]
:debug [:time]}
}}
Expand Down Expand Up @@ -2202,7 +2202,7 @@ your local Maven repository:
$ cd path/to/eastwood
$ lein with-profile -user,-dev,+eastwood-plugin install

Then add `[jonase/eastwood "1.2.4"]` to
Then add `[jonase/eastwood "1.2.5"]` to
your `:plugins` vector in your `:user` profile, perhaps in your
`$HOME/.lein/profiles.clj` file.

Expand All @@ -2226,26 +2226,12 @@ License 1.0.

Copyright (c) Rich Hickey, Michael Fogus and contributors, 2012. All rights reserved. The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.

### core.contracts

[core.contracts](https://github.com/clojure/core.contracts)

Copyright (c) Rich Hickey, Michael Fogus and contributors, 2012. All rights reserved. The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.

### core.memoize

[core.memoize](https://github.com/clojure/core.memoize)

Copyright (c) Rich Hickey and Michael Fogus, 2012, 2013. All rights reserved. The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.

### core.unify

[core.unify](https://github.com/clojure/core.unify)

Copyright © 2011 Rich Hickey

Licensed under the EPL. (See the file epl.html.)

### data.priority-map

Copyright (C) 2013 Mark Engelberg
Expand All @@ -2254,15 +2240,6 @@ Distributed under the Eclipse Public License, the same as Clojure.

[data.priority-map](https://github.com/clojure/data.priority-map)

### leinjacker

[leinjacker](https://github.com/sattvik/leinjacker)

Copyright © 2012 Sattvik Software & Technology Resources, Ltd. Co.
All rights reserved.

Distributed under the Eclipse Public License, the same as Clojure.

### tools.analyzer

[tools.analyzer](https://github.com/clojure/tools.analyzer)
Expand Down
7 changes: 7 additions & 0 deletions changes.md
@@ -1,3 +1,10 @@
## Changes from 1.2.5 to 1.2.5

#### Bugfixes

* Upgrade `tools.namespace`.
* Closes https://github.com/jonase/eastwood/issues/439

## Changes from 1.2.3 to 1.2.4

#### Bugfixes
Expand Down
Expand Up @@ -102,7 +102,7 @@
* :form the form represented by the AST node
* :env the environment map of the AST node
Additionaly if the AST node contains sub-nodes, it is guaranteed to have:
Additionally if the AST node contains sub-nodes, it is guaranteed to have:
* :children a vector of the keys of the AST node mapping to the sub-nodes,
ordered, when that makes sense
Expand Down
Expand Up @@ -12,7 +12,7 @@
(:require [eastwood.copieddeps.dep1.clojure.tools.analyzer.utils :refer [into! rseqv mapv']]))

(defn cycling
"Combine the given passes in a single pass that will be applieed repeatedly
"Combine the given passes in a single pass that will be applied repeatedly
to the AST until applying it another time will have no effect"
[& fns*]
(let [fns (cycle fns*)]
Expand All @@ -26,7 +26,7 @@
(defn children*
"Return a vector of vectors of the children node key and the children expression
of the AST node, if it has any.
The returned vector returns the childrens in the order as they appear in the
The returned vector returns the children in the order as they appear in the
:children field of the AST, and the children expressions may be either a node
or a vector of nodes."
[{:keys [children] :as ast}]
Expand Down
Expand Up @@ -12,7 +12,7 @@
[eastwood.copieddeps.dep1.clojure.tools.analyzer.utils :refer [compile-if]]))

(defn query-map
"Transoforms a Datomic query from its vector representation to its map one.
"Transforms a Datomic query from its vector representation to its map one.
If the given query is already in its map representation, the original query
is returned."
[query]
Expand All @@ -29,7 +29,7 @@
"Given a Datomic query, walk the :where clauses searching for
expression clauses with nested calls, unnesting those calls.
E.g {:where [[(inc (dec ?foo)) ?bar] ..] ..} will be transformed in
E.g {:where [[(inc (dec ?foo)) ?bar] ..] ..} will be transformed into
{:where [[(dec ?foo) ?1234] [(inc ?1234) ?bar] ..] ..}"
[query]
(let [{:keys [where] :as query} (query-map query)]
Expand Down Expand Up @@ -73,7 +73,7 @@

(defn db
"Given a list of ASTs, returns a representation of those
that can be used as a database in a Datomic Datalog query"
that can be used as a database in a Datomic Datalog query."
[asts]
(mapcat ast/ast->eav asts))

Expand Down
Expand Up @@ -10,9 +10,9 @@
(:refer-clojure :exclude [ensure]))

(def ^:dynamic *env*
"Global env atom
"Global env atom containing a map.
Required options:
* :namespaces an atom containing a map from namespace symbol to namespace map,
* :namespaces a map from namespace symbol to namespace map,
the namespace map contains at least the following keys:
** :mappings a map of mappings of the namespace, symbol to var/class
** :aliases a map of the aliases of the namespace, symbol to symbol
Expand Down
Expand Up @@ -5,7 +5,7 @@
[eastwood.copieddeps.dep1.clojure.tools.analyzer.utils :refer [update-vals]]))

(defn ^:private has-deps?
"Returns true if the pass has some dependencies"
"Returns true if the pass has any dependencies"
[pass]
(seq (:dependencies pass)))

Expand All @@ -16,7 +16,7 @@

(defn ^:private remove-pass
"Takes a set of pass-infos and a pass, and removes the pass from the set of
pass-infos, updating :dependencies and :dependants aswell"
pass-infos, updating :dependencies and :dependants as well."
[passes pass]
(indicize (reduce (fn [m p] (conj m (-> p (update-in [:dependencies] disj pass)
(update-in [:dependants] disj pass))))
Expand Down Expand Up @@ -46,7 +46,7 @@

(defn calculate-deps
"Takes a map of pass-name -> pass-info and adds to each pass-info :dependencies and
:dependants info, which also contain the transitive dependencies"
:dependants info, which also contains the transitive dependencies"
[passes]
(let [passes (desugar-deps passes)
dependencies (reduce-kv (fn [deps pname {:keys [depends]}]
Expand All @@ -66,7 +66,7 @@
* the remaining scheduler state
E.g. given:
[{:walk :any .. } {:walk :pre ..} {:walk :post ..} {:walk :pre ..}]
[{:walk :any ..} {:walk :pre ..} {:walk :post ..} {:walk :pre ..}]
it will return:
[:pre [{:walk :any ..} {:walk :pre ..}] [{:walk :post ..} {:walk :pre ..}]]"
[state]
Expand Down Expand Up @@ -192,7 +192,7 @@
- :any if the pass can be composed with other passes in both a prewalk
or a postwalk
* :affects a set of Vars, this pass must be the last in the same tree traversal that all
the specified passes must partecipate in
the specified passes must participate in
This pass must take a function as argument and return the actual pass, the
argument represents the reified tree traversal which the pass can use to
control a recursive traversal, implies :depends
Expand Down
Expand Up @@ -24,6 +24,10 @@
(swap! state assoc (:name ast) a)
(assoc ast :atom a))
:local
(assoc ast :atom (or (@state (:name ast))
(atom {})))
(if-let [a (@state (:name ast))]
(assoc ast :atom a)
;; handle injected locals
(let [a (get-in ast [:env :locals (:name ast) :atom] (atom {}))]
(swap! state assoc (:name ast) a)
(assoc ast :atom a)))
ast)))
Expand Up @@ -73,7 +73,10 @@
(if (= new-meta (:form meta))
ast
(assoc ast :meta (replace-meta meta new-meta)))
(assoc (dissoc ast :meta) :children [:init]))
(let [ast (dissoc ast :meta)]
(if-let [new-children (not-empty (filterv (complement #{:meta}) (:children ast)))]
(assoc ast :children new-children)
(dissoc ast :children))))
ast)))

(defn elide-meta
Expand Down
11 changes: 9 additions & 2 deletions copied-deps/eastwood/copieddeps/dep11/clojure/java/classpath.clj
Expand Up @@ -69,15 +69,22 @@
(map io/as-file (get-urls loader)))

(defn classpath
"Returns a sequence of File objects of the elements on the classpath."
"Returns a sequence of File objects of the elements on the
classpath. Defaults to searching for instances of
java.net.URLClassLoader in the classloader hierarchy above
clojure.lang.RT/baseLoader or the given classloader. If no
URLClassloader can be found, as on Java 9, falls back to the
'java.class'path' system property."
([classloader]
(distinct
(mapcat
loader-classpath
(take-while
identity
(iterate #(.getParent ^ClassLoader %) classloader)))))
([] (classpath (clojure.lang.RT/baseLoader))))
([]
(or (seq (classpath (clojure.lang.RT/baseLoader)))
(system-classpath))))

(defn classpath-directories
"Returns a sequence of File objects for the directories on classpath."
Expand Down
Expand Up @@ -199,7 +199,7 @@
macro?
(let [res (apply v form (:locals env) (rest form))] ; (m &form &env & args)
(when-not (ns-safe-macro v)
(update-ns-map!))
(update-ns-map!))
(if (obj? res)
(vary-meta res merge (meta form))
res))
Expand Down Expand Up @@ -293,7 +293,7 @@
(not (vector? args))
(str "Parameter listing should be a vector, had: " (class args))
(not (first args))
(str"Must supply at least one argument for 'this' in: " method))]
(str "Must supply at least one argument for 'this' in: " method))]
(throw (ex-info error-msg
(merge {:form form
:in (:this env)
Expand Down Expand Up @@ -325,9 +325,9 @@
(memo-clear! members* [(str arg)]))

(let [interfaces (mapv #(symbol (.getName ^Class %)) interfaces)]
(eval (list 'let []
(eval (list `let []
(list 'deftype* name class-name args :implements interfaces)
(list 'import class-name)))))
(list `import class-name)))))

(defn parse-reify*
[[_ interfaces & methods :as form] env]
Expand Down
Expand Up @@ -34,7 +34,7 @@

(defmethod validate-recur :recur [ast]
(when (-> ast :env :no-recur)
(throw (ex-info "Cannot recur accross try"
(throw (ex-info "Cannot recur across try"
(merge {:form (:form ast)}
(-source-info (:form ast) (:env ast))))))
ast)

0 comments on commit caf8720

Please sign in to comment.