diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-02-03 15:01:05 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-02-03 15:01:05 +0000 |
commit | ce4f1d217a0b2384fedfccaceb7468e6a2dad99d (patch) | |
tree | 11ce1cb4fa33b492628f45d9e107e6b2ec1b8b6a /src/jvm/clojure | |
parent | 0ef809b4c3ec11e0ba793903457dba5a9f8e3200 (diff) |
removed binding injection in let [x (fn ... and added optional anonymous function name binding (fn name [args] ...)
Diffstat (limited to 'src/jvm/clojure')
-rw-r--r-- | src/jvm/clojure/lang/Compiler.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index 6ae0287b..4b87bf71 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -2340,7 +2340,7 @@ static class FnExpr implements Expr{ static Expr parse(C context, ISeq form, String name) throws Exception{ FnExpr fn = new FnExpr(); FnMethod enclosingMethod = (FnMethod) METHOD.get(); - fn.thisName = name; + //fn.thisName = name; String basename = enclosingMethod != null ? (enclosingMethod.fn.name + "$") : (munge(currentNS().name.name) + "."); @@ -2356,7 +2356,15 @@ static class FnExpr implements Expr{ RT.map(CONSTANTS, PersistentVector.EMPTY, KEYWORDS, PersistentHashMap.EMPTY, VARS, PersistentHashMap.EMPTY)); - //(fn [args] body...) or (fn ([args] body...) ([args2] body2...) ...) + + //arglist might be preceded by symbol naming this fn + if(RT.second(form) instanceof Symbol) + { + fn.thisName = ((Symbol)RT.second(form)).name; + form = RT.cons(FN, RT.rest(RT.rest(form))); + } + + //now (fn [args] body...) or (fn ([args] body...) ([args2] body2...) ...) //turn former into latter if(RT.second(form) instanceof IPersistentVector) form = RT.list(FN, RT.rest(form)); |