MCPcopy Index your code
hub / github.com/clojure/clojure / maybeClass

Method maybeClass

src/jvm/clojure/lang/Compiler.java:1022–1058  ·  view source on GitHub ↗
(Object form, boolean stringOk)

Source from the content-addressed store, hash-verified

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){

Callers 10

tagToClassMethod · 0.95
maybeArrayClassMethod · 0.95
parseMethod · 0.95
parseMethod · 0.95
InvokeExprMethod · 0.95
doEmitMethod · 0.95
macroexpand1Method · 0.95
analyzeSymbolMethod · 0.95
parseMethod · 0.80

Calls 8

equalsMethod · 0.95
getMappingMethod · 0.80
getMethod · 0.65
currentNSMethod · 0.65
derefMethod · 0.65
containsKeyMethod · 0.65
indexOfMethod · 0.45

Tested by

no test coverage detected