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

Method parse

src/jvm/clojure/lang/Compiler.java:4067–4124  ·  view source on GitHub ↗
(Var v, ISeq args, Object tag, boolean tailPosition)

Source from the content-addressed store, hash-verified

4065 }
4066
4067 public static Expr parse(Var v, ISeq args, Object tag, boolean tailPosition) {
4068 if(!v.isBound() || v.get() == null)
4069 {
4070// System.out.println("Not bound: " + v);
4071 return null;
4072 }
4073 Class c = v.get().getClass();
4074 String cname = c.getName();
4075// System.out.println("Class: " + cname);
4076
4077 java.lang.reflect.Method[] allmethods = c.getMethods();
4078
4079 boolean variadic = false;
4080 int argcount = RT.count(args);
4081 java.lang.reflect.Method method = null;
4082 for(java.lang.reflect.Method m : allmethods)
4083 {
4084 //System.out.println(m);
4085 if(Modifier.isStatic(m.getModifiers()) && m.getName().equals("invokeStatic"))
4086 {
4087 Class[] params = m.getParameterTypes();
4088 if(argcount == params.length)
4089 {
4090 method = m;
4091 variadic = argcount > 0 && params[params.length-1] == ISeq.class;
4092 break;
4093 }
4094 else if(argcount > params.length
4095 && params.length > 0
4096 && params[params.length-1] == ISeq.class)
4097 {
4098 method = m;
4099 variadic = true;
4100 break;
4101 }
4102 }
4103 }
4104 if(method == null)
4105 return null;
4106
4107 Class retClass = method.getReturnType();
4108
4109 Class[] paramClasses = method.getParameterTypes();
4110 Type[] paramTypes = new Type[paramClasses.length];
4111
4112 for(int i = 0;i<paramClasses.length;i++)
4113 {
4114 paramTypes[i] = Type.getType(paramClasses[i]);
4115 }
4116
4117 Type target = Type.getType(c);
4118
4119 PersistentVector argv = PersistentVector.EMPTY;
4120 for(ISeq s = RT.seq(args); s != null; s = s.next())
4121 argv = argv.cons(analyze(C.EXPRESSION, s.first()));
4122
4123 return new StaticInvokeExpr(target,retClass,paramClasses, paramTypes,variadic, argv, tag, tailPosition);
4124 }

Callers 1

parseMethod · 0.95

Calls 13

countMethod · 0.95
getTypeMethod · 0.95
seqMethod · 0.95
nextMethod · 0.95
consMethod · 0.95
firstMethod · 0.95
getMethodsMethod · 0.80
analyzeMethod · 0.80
getMethod · 0.65
getNameMethod · 0.65
isBoundMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected