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

Method parse

src/jvm/clojure/lang/Compiler.java:4336–4439  ·  view source on GitHub ↗
(C context, ISeq form)

Source from the content-addressed store, hash-verified

4334 }
4335
4336 static public Expr parse(C context, ISeq form) {
4337 boolean tailPosition = inTailCall(context);
4338 if(context != C.EVAL)
4339 context = C.EXPRESSION;
4340 Expr fexpr = analyze(context, form.first());
4341 if(fexpr instanceof VarExpr && ((VarExpr)fexpr).var.equals(INSTANCE) && RT.count(form) == 3)
4342 {
4343 Expr sexpr = analyze(C.EXPRESSION, RT.second(form));
4344 if(sexpr instanceof ConstantExpr)
4345 {
4346 Object val = ((ConstantExpr) sexpr).val();
4347 if(val instanceof Class)
4348 {
4349 return new InstanceOfExpr((Class) val, analyze(context, RT.third(form)));
4350 }
4351 }
4352 }
4353
4354 if(RT.booleanCast(getCompilerOption(directLinkingKey))
4355 && fexpr instanceof VarExpr
4356 && context != C.EVAL)
4357 {
4358 Var v = ((VarExpr)fexpr).var;
4359 if(!v.isDynamic() && !RT.booleanCast(RT.get(v.meta(), redefKey, false)))
4360 {
4361 Symbol formtag = tagOf(form);
4362 Object arglists = RT.get(RT.meta(v), arglistsKey);
4363 int arity = RT.count(form.next());
4364 Object sigtag = sigTag(arity, v);
4365 Object vtag = RT.get(RT.meta(v), RT.TAG_KEY);
4366 Expr ret = StaticInvokeExpr
4367 .parse(v, RT.next(form), formtag != null ? formtag : sigtag != null ? sigtag : vtag, tailPosition);
4368 if(ret != null)
4369 {
4370// System.out.println("invoke direct: " + v);
4371 return ret;
4372 }
4373// System.out.println("NOT direct: " + v);
4374 }
4375 }
4376
4377 if(fexpr instanceof VarExpr && context != C.EVAL)
4378 {
4379 Var v = ((VarExpr)fexpr).var;
4380 Object arglists = RT.get(RT.meta(v), arglistsKey);
4381 int arity = RT.count(form.next());
4382 for(ISeq s = RT.seq(arglists); s != null; s = s.next())
4383 {
4384 IPersistentVector args = (IPersistentVector) s.first();
4385 if(args.count() == arity)
4386 {
4387 String primc = FnMethod.primInterface(args);
4388 if(primc != null)
4389 return analyze(context,
4390 ((IObj)RT.listStar(Symbol.intern(".invokePrim"),
4391 ((Symbol) form.first()).withMeta(RT.map(RT.TAG_KEY, Symbol.intern(primc))),
4392 form.next())).withMeta((IPersistentMap)RT.conj(RT.meta(v), RT.meta(form))));
4393 break;

Callers 1

analyzeSeqMethod · 0.95

Calls 15

firstMethod · 0.95
countMethod · 0.95
secondMethod · 0.95
thirdMethod · 0.95
booleanCastMethod · 0.95
isDynamicMethod · 0.95
getMethod · 0.95
metaMethod · 0.95
nextMethod · 0.95
sigTagMethod · 0.95
parseMethod · 0.95
nextMethod · 0.95

Tested by

no test coverage detected