(Object form, boolean stringOk)
| 1020 | } |
| 1021 | |
| 1022 | public static Class maybeClass(Object form, boolean stringOk) { |
| 1023 | if(form instanceof Class) |
| 1024 | return (Class) form; |
| 1025 | Class c = null; |
| 1026 | if(form instanceof Symbol) |
| 1027 | { |
| 1028 | Symbol sym = (Symbol) form; |
| 1029 | if(sym.ns == null) //if ns-qualified can't be classname |
| 1030 | { |
| 1031 | if(Util.equals(sym,COMPILE_STUB_SYM.get())) |
| 1032 | return (Class) COMPILE_STUB_CLASS.get(); |
| 1033 | if(sym.name.indexOf('.') > 0 || sym.name.charAt(0) == '[') |
| 1034 | c = RT.classForNameNonLoading(sym.name); |
| 1035 | else |
| 1036 | { |
| 1037 | Object o = currentNS().getMapping(sym); |
| 1038 | if(o instanceof Class) |
| 1039 | c = (Class) o; |
| 1040 | else if(LOCAL_ENV.deref() != null && ((java.util.Map)LOCAL_ENV.deref()).containsKey(form)) |
| 1041 | return null; |
| 1042 | else |
| 1043 | { |
| 1044 | try{ |
| 1045 | c = RT.classForNameNonLoading(sym.name); |
| 1046 | } |
| 1047 | catch(Exception e){ |
| 1048 | // aargh |
| 1049 | // leave c set to null -> return null |
| 1050 | } |
| 1051 | } |
| 1052 | } |
| 1053 | } |
| 1054 | } |
| 1055 | else if(stringOk && form instanceof String) |
| 1056 | c = RT.classForNameNonLoading((String) form); |
| 1057 | return c; |
| 1058 | } |
| 1059 | |
| 1060 | /* |
| 1061 | private static String maybeClassName(Object form, boolean stringOk){ |
no test coverage detected