summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-02-04 14:30:20 +0000
committerRich Hickey <richhickey@gmail.com>2008-02-04 14:30:20 +0000
commit9ba0f1bbd25b92467b7da6facdc9bbf8cdedbebf (patch)
treefaaa8925a53175d3b2250b8bbee0b49ea68f8106
parent2133a7556144c5d1fdac70c6051dc36d8cc5cfc4 (diff)
prevent access to non-exported macro from other ns
-rw-r--r--src/jvm/clojure/lang/Compiler.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
index 4b87bf71..bb933d7a 100644
--- a/src/jvm/clojure/lang/Compiler.java
+++ b/src/jvm/clojure/lang/Compiler.java
@@ -2360,7 +2360,7 @@ static class FnExpr implements Expr{
//arglist might be preceded by symbol naming this fn
if(RT.second(form) instanceof Symbol)
{
- fn.thisName = ((Symbol)RT.second(form)).name;
+ fn.thisName = ((Symbol) RT.second(form)).name;
form = RT.cons(FN, RT.rest(RT.rest(form)));
}
@@ -2693,7 +2693,7 @@ static class FnMethod{
//register 'this' as local 0
//registerLocal(THISFN, null, null);
- registerLocal(Symbol.intern(fn.thisName != null?fn.thisName:"fn__" + RT.nextID()), null, null);
+ registerLocal(Symbol.intern(fn.thisName != null ? fn.thisName : "fn__" + RT.nextID()), null, null);
PSTATE state = PSTATE.REQ;
PersistentVector argLocals = PersistentVector.EMPTY;
@@ -3143,7 +3143,11 @@ static public Var isMacro(Object op) throws Exception{
{
Var v = (op instanceof Var) ? (Var) op : lookupVar((Symbol) op, false);
if(v != null && v.isMacro())
+ {
+ if(v.ns != currentNS() && !v.isExported())
+ throw new IllegalAccessError("var: " + v + " is not exported");
return v;
+ }
}
return null;
}