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

Method InvokeExpr

src/jvm/clojure/lang/Compiler.java:4164–4213  ·  view source on GitHub ↗
(String source, int line, int column, Symbol tag, Expr fexpr, IPersistentVector args, boolean tailPosition)

Source from the content-addressed store, hash-verified

4162 }
4163
4164 public InvokeExpr(String source, int line, int column, Symbol tag, Expr fexpr, IPersistentVector args, boolean tailPosition) {
4165 this.source = source;
4166 this.fexpr = fexpr;
4167 this.args = args;
4168 this.line = line;
4169 this.column = column;
4170 this.tailPosition = tailPosition;
4171
4172 if(fexpr instanceof VarExpr)
4173 {
4174 Var fvar = ((VarExpr)fexpr).var;
4175 Var pvar = (Var)RT.get(fvar.meta(), protocolKey);
4176 if(pvar != null && shouldRegisterCallsites(PROTOCOL_CALLSITES))
4177 {
4178 this.isProtocol = true;
4179 this.siteIndex = registerProtocolCallsite(((VarExpr)fexpr).var);
4180 Object pon = RT.get(pvar.get(), onKey);
4181 this.protocolOn = HostExpr.maybeClass(pon,false);
4182 if(this.protocolOn != null)
4183 {
4184 IPersistentMap mmap = (IPersistentMap) RT.get(pvar.get(), methodMapKey);
4185 Keyword mmapVal = (Keyword) mmap.valAt(Keyword.intern(fvar.sym));
4186 if (mmapVal == null) {
4187 throw new IllegalArgumentException(
4188 "No method of interface: " + protocolOn.getName() +
4189 " found for function: " + fvar.sym + " of protocol: " + pvar.sym +
4190 " (The protocol method may have been defined before and removed.)");
4191 }
4192 String mname = munge(mmapVal.sym.toString());
4193 List methods = Reflector.getMethods(protocolOn, args.count() - 1, mname, false);
4194 if(methods.size() != 1)
4195 throw new IllegalArgumentException(
4196 "No single method: " + mname + " of interface: " + protocolOn.getName() +
4197 " found for function: " + fvar.sym + " of protocol: " + pvar.sym);
4198 this.onMethod = (java.lang.reflect.Method) methods.get(0);
4199 }
4200 }
4201 }
4202
4203 if (tag != null) {
4204 this.tag = tag;
4205 } else if (fexpr instanceof VarExpr) {
4206 Var v = ((VarExpr) fexpr).var;
4207 Object arglists = RT.get(RT.meta(v), arglistsKey);
4208 Object sigTag = sigTag(args.count(),v);
4209 this.tag = sigTag == null ? ((VarExpr) fexpr).tag : sigTag;
4210 } else {
4211 this.tag = null;
4212 }
4213 }
4214
4215 public Object eval() {
4216 try

Callers

nothing calls this directly

Calls 15

getMethod · 0.95
getMethod · 0.95
maybeClassMethod · 0.95
internMethod · 0.95
getMethodsMethod · 0.95
metaMethod · 0.95
sigTagMethod · 0.95
mungeMethod · 0.80
metaMethod · 0.65
valAtMethod · 0.65

Tested by

no test coverage detected