-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC for CLJS support for find-locals
as outlined in #195, see specially #195 (comment) Take aways: - one integration test is duplicated for cljs (together with the source file) - `cljs.analyzer` used directly instead of `jvm.tools.analyzer` -- latter errored with latest cljs, did not investigate further - workarounds needed for - no `end-line`, `end-column` info in CLJS AST (also see https://dev.clojure.org/jira/browse/CLJS-2051) - no `:raw-forms` in cljs AST containing the stages of macro expansion including the original form - :op = `:binding` nodes in CLJS ASTs seems to be missing `:children` entry so the AST can not be walked properly
- Loading branch information
1 parent
c252bd4
commit ffcbf70
Showing
5 changed files
with
222 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(ns com.example.five-cljs | ||
(:require [clojure.string :refer [join split blank? trim] :as str])) | ||
|
||
;; remove parameters to run the tests | ||
(defn fn-with-unbounds [s sep] | ||
(when-not (blank? s) | ||
(-> s (split #" ") | ||
(join sep) | ||
trim))) | ||
|
||
(defn orig-fn [s] | ||
(let [sep ";"] | ||
(when-not (blank? s) | ||
(-> s | ||
(split #" ") | ||
((partial join sep)) | ||
trim)))) | ||
|
||
(defn find-in-let [s p] | ||
(let [z (trim p)] | ||
(assoc {:s s | ||
:p p | ||
:z z} :k "foobar"))) | ||
|
||
(defn threading-macro [strings] | ||
(let [sep ","] | ||
(->> strings | ||
flatten | ||
(join sep)))) | ||
|
||
(defn repeated-sexp [] | ||
(map name [:a :b :c]) | ||
(let [name #(str "myname" %)] | ||
(map name [:a :b :c]))) | ||
|
||
(defn sexp-with-anon-fn [n] | ||
(let [g 5] | ||
(#(+ g %) n))) | ||
|
||
(defn many-params [x y z a b c] | ||
(* x y z a b c)) | ||
|
||
(defn fn-with-default-optmap | ||
[{:keys [foo bar] :or {foo "foo"}}] | ||
[:bar :foo] | ||
(count foo)) | ||
|
||
(defn fn-with-default-optmap-linebreak | ||
[{:keys [foo | ||
bar] | ||
:or {foo | ||
"foo"}}] | ||
[:bar :foo] | ||
(count foo)) | ||
|
||
(defn fn-with-let-default-optmap [] | ||
(let [{:keys [foo bar] :or {foo "foo"}} (hash-map)] | ||
[:bar :foo] | ||
(count foo))) |