diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-10-13 00:57:36 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-10-13 00:57:36 +0000 |
commit | 170bace615638e8ef0aae1db1e86341b2032db2c (patch) | |
tree | 197fe7da5d34de78e9064b8a0eb2881ce4cdd3fa /src | |
parent | c176f33ca4ac30b577fe6d5dec43c8707d009533 (diff) |
allow private vars in reader literals
Diffstat (limited to 'src')
-rw-r--r-- | src/jvm/clojure/lang/Compiler.java | 10 | ||||
-rw-r--r-- | src/jvm/clojure/lang/LispReader.java | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index 605a1586..eb1f4f70 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -4169,8 +4169,12 @@ private static Expr analyzeSymbol(Symbol sym) throws Exception{ } +static Object resolve(Symbol sym, boolean allowPrivate) throws Exception{ + return resolveIn(currentNS(), sym, allowPrivate); +} + static Object resolve(Symbol sym) throws Exception{ - return resolveIn(currentNS(), sym); + return resolveIn(currentNS(), sym, false); } static private Namespace namespaceFor(Symbol sym){ @@ -4190,7 +4194,7 @@ static private Namespace namespaceFor(Namespace inns, Symbol sym){ return ns; } -static public Object resolveIn(Namespace n, Symbol sym) throws Exception{ +static public Object resolveIn(Namespace n, Symbol sym, boolean allowPrivate) throws Exception{ //note - ns-qualified vars must already exist if(sym.ns != null) { @@ -4201,7 +4205,7 @@ static public Object resolveIn(Namespace n, Symbol sym) throws Exception{ Var v = ns.findInternedVar(Symbol.create(sym.name)); if(v == null) throw new Exception("No such var: " + sym); - else if(v.ns != currentNS() && !v.isPublic()) + else if(v.ns != currentNS() && !v.isPublic() && !allowPrivate) throw new IllegalStateException("var: " + sym + " is not public"); return v; } diff --git a/src/jvm/clojure/lang/LispReader.java b/src/jvm/clojure/lang/LispReader.java index 3107eda4..afc95835 100644 --- a/src/jvm/clojure/lang/LispReader.java +++ b/src/jvm/clojure/lang/LispReader.java @@ -868,7 +868,7 @@ static class EvalReader extends AFn{ Symbol fs = (Symbol) RT.first(o);
if(fs.equals(THE_VAR))
{
- return Compiler.resolve((Symbol) RT.second(o));
+ return Compiler.resolve((Symbol) RT.second(o),true);
}
if(fs.name.endsWith("."))
{
|