Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 51ebc9b9e2
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (28 sloc) 0.936 kb
(ns clojure.core.typed.analyze-clj
(:require [clojure.tools.analyzer :as analyze]
[clojure.tools.analyzer.hygienic :as hygienic]
(clojure.core.typed
[utils :as u :refer [p]])))
(defn ast-for-form-in-ns
"Returns an AST node for the form
analyzed in the given namespace"
[nsym form]
(-> (analyze/analyze-form-in-ns nsym form)
hygienic/ast-hy))
(defn ast-for-form
"Returns an AST node for the form"
[form]
(-> (analyze/analyze-form form)
hygienic/ast-hy))
(defn ast-for-ns
"Returns a vector of AST nodes contained
in the given namespace symbol nsym"
[nsym]
{:pre [(symbol? nsym)]}
(p :analyze/ast-for-ns
(with-open [^clojure.lang.LineNumberingPushbackReader pbr (analyze/pb-reader-for-ns nsym)]
(let [astv (->> (analyze/analyze-ns pbr (analyze/uri-for-ns nsym) nsym)
(map hygienic/ast-hy)
vec)]
astv)))
)
Jump to Line
Something went wrong with that request. Please try again.