diff options
author | Chouser <chouser@n01se.net> | 2009-01-21 04:31:47 +0000 |
---|---|---|
committer | Chouser <chouser@n01se.net> | 2009-01-21 04:31:47 +0000 |
commit | 3054d8e76eacdb5a6b7885e528405b6fac877c4e (patch) | |
tree | d9ad9f208b3b805924981b256a7c089140927d0e /clojurescript/src/clojure/contrib/clojurescript.clj | |
parent | a896cc837716e11cb7c8fd3d24a5217efc05ff52 (diff) |
Remove remote server for repl in favor of compiler applet. Incomplete support for new IMeta structure.
Diffstat (limited to 'clojurescript/src/clojure/contrib/clojurescript.clj')
-rw-r--r-- | clojurescript/src/clojure/contrib/clojurescript.clj | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/clojurescript/src/clojure/contrib/clojurescript.clj b/clojurescript/src/clojure/contrib/clojurescript.clj index 66e7eac3..1b8d696a 100644 --- a/clojurescript/src/clojure/contrib/clojurescript.clj +++ b/clojurescript/src/clojure/contrib/clojurescript.clj @@ -304,30 +304,31 @@ (defn formtojs [f] (when-not (and (coll? f) (= 'definline (first f))) - (binding [*allow-unresolved-vars* true - *private-compiler-loader* (clojure.lang.RT/makeClassLoader)] - (let [expr (Compiler/analyze Compiler$C/STATEMENT `((fn [] ~f))) - mainexpr (-> expr .fexpr .methods first .body .exprs first) - defmacro? (and (instance? Compiler$BodyExpr mainexpr) - (instance? Compiler$DefExpr (first (.exprs mainexpr))) - (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) - (= "setMacro" (.methodName (second (.exprs mainexpr)))))] - (if defmacro? - (when *eval-defmacro* - (eval f) - nil) - (when-not (or (and (instance? Compiler$DefExpr mainexpr) - (skip-def (:name ^(.var mainexpr)))) - (and (instance? Compiler$InstanceMethodExpr mainexpr) - (or (= "setMacro" (.methodName mainexpr)) - (and (= "addMethod" (.methodName mainexpr)) - (skip-method (tojs (first (.args mainexpr)) - nil))))) - (and (instance? Compiler$BodyExpr mainexpr) - (instance? Compiler$DefExpr (first (.exprs mainexpr))) - (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) - (= "setMacro" (.methodName (second (.exprs mainexpr)))))) - (tojs expr {:localmap {}}))))))) + (let [expr (binding [*allow-unresolved-vars* true + *compiler-analyze-only* true + *private-compiler-loader* (clojure.lang.RT/baseLoader)] + (Compiler/analyze Compiler$C/STATEMENT `((fn [] ~f)))) + mainexpr (-> expr .fexpr .methods first .body .exprs first) + defmacro? (and (instance? Compiler$BodyExpr mainexpr) + (instance? Compiler$DefExpr (first (.exprs mainexpr))) + (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) + (= "setMacro" (.methodName (second (.exprs mainexpr)))))] + (if defmacro? + (when *eval-defmacro* + (eval f) + nil) + (when-not (or (and (instance? Compiler$DefExpr mainexpr) + (skip-def (:name ^(.var mainexpr)))) + (and (instance? Compiler$InstanceMethodExpr mainexpr) + (or (= "setMacro" (.methodName mainexpr)) + (and (= "addMethod" (.methodName mainexpr)) + (skip-method (tojs (first (.args mainexpr)) + nil))))) + (and (instance? Compiler$BodyExpr mainexpr) + (instance? Compiler$DefExpr (first (.exprs mainexpr))) + (instance? Compiler$InstanceMethodExpr (second (.exprs mainexpr))) + (= "setMacro" (.methodName (second (.exprs mainexpr)))))) + (tojs expr {:localmap {}})))))) (defn filetojs [filename & optseq] (let [reader (java.io.PushbackReader. (ds/reader filename)) |