diff options
author | Rich Hickey <richhickey@gmail.com> | 2007-11-28 14:09:23 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2007-11-28 14:09:23 +0000 |
commit | b1da9ba5440902d6de646f5b04f726c7778028e7 (patch) | |
tree | d2bcc37095cfed179d7f29d04aae481249b50cd6 /src | |
parent | e40ebe81b7f21ba844c08e3411ce437557630a3f (diff) |
fixed def at top-level eval context
Diffstat (limited to 'src')
-rw-r--r-- | src/jvm/clojure/lang/Compiler.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index 3f630cbf..3059c026 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -276,7 +276,8 @@ static class DefExpr implements Expr{ else throw new Exception("Can't create defs outside of current ns"); } - return new DefExpr(v, analyze(C.EXPRESSION, RT.third(form), v.sym.name), RT.count(form) == 3); + return new DefExpr(v, analyze(context == C.EVAL ? context : C.EXPRESSION, RT.third(form), v.sym.name), + RT.count(form) == 3); } } } @@ -546,7 +547,7 @@ static abstract class HostExpr implements Expr{ else { if(returnType == int.class) - //gen.invokeStatic(NUM_TYPE, fromIntMethod); + //gen.invokeStatic(NUM_TYPE, fromIntMethod); gen.invokeStatic(INTEGER_TYPE, intValueOfMethod); else if(returnType == float.class) { @@ -565,7 +566,8 @@ static abstract class HostExpr implements Expr{ } } } -//*/ + + //*/ public static void emitUnboxArg(FnExpr fn, GeneratorAdapter gen, Class paramType){ if(paramType.isPrimitive()) { @@ -2621,9 +2623,9 @@ private static Expr analyzeSeq(C context, ISeq form, String name) throws Excepti { if(!(e instanceof CompilerException)) throw new CompilerException(String.format("%s:%d: %s", SOURCE.get(), (Integer) LINE.get(), e.getMessage()), - e); + e); else - throw (CompilerException)e; + throw (CompilerException) e; } finally { |