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

Method parse

src/jvm/clojure/lang/Compiler.java:4535–4700  ·  view source on GitHub ↗
(C context, ISeq form, String name)

Source from the content-addressed store, hash-verified

4533 }
4534
4535 static Expr parse(C context, ISeq form, String name) {
4536 ISeq origForm = form;
4537 FnExpr fn = new FnExpr(tagOf(form));
4538 Keyword retkey = Keyword.intern(null, "rettag");
4539 Object rettag = RT.get(RT.meta(form), retkey);
4540 fn.src = form;
4541 ObjMethod enclosingMethod = (ObjMethod) METHOD.deref();
4542 fn.hasEnclosingMethod = enclosingMethod != null;
4543 if(((IMeta) form.first()).meta() != null)
4544 {
4545 fn.onceOnly = RT.booleanCast(RT.get(RT.meta(form.first()), Keyword.intern(null, "once")));
4546// fn.superName = (String) RT.get(RT.meta(form.first()), Keyword.intern(null, "super-name"));
4547 }
4548 //fn.thisName = name;
4549
4550 String basename = (enclosingMethod != null ?
4551 enclosingMethod.objx.name
4552 : (munge(currentNS().name.name))) + "$";
4553
4554 Symbol nm = null;
4555
4556 if(RT.second(form) instanceof Symbol) {
4557 nm = (Symbol) RT.second(form);
4558 name = nm.name + "__" + RT.nextID();
4559 } else {
4560 if(name == null)
4561 name = "fn__" + RT.nextID();
4562 else if (enclosingMethod != null)
4563 name += "__" + RT.nextID();
4564 }
4565
4566 String simpleName = munge(name).replace(".", "_DOT_");
4567
4568 fn.name = basename + simpleName;
4569 fn.internalName = fn.name.replace('.', '/');
4570 fn.objtype = Type.getObjectType(fn.internalName);
4571 ArrayList<String> prims = new ArrayList();
4572 try
4573 {
4574 Var.pushThreadBindings(
4575 RT.mapUniqueKeys(CONSTANTS, PersistentVector.EMPTY,
4576 CONSTANT_IDS, new IdentityHashMap(),
4577 KEYWORDS, PersistentHashMap.EMPTY,
4578 VARS, PersistentHashMap.EMPTY,
4579 KEYWORD_CALLSITES, PersistentVector.EMPTY,
4580 PROTOCOL_CALLSITES, PersistentVector.EMPTY,
4581 //VAR_CALLSITES, emptyVarCallSites(),
4582 NO_RECUR, null
4583 ));
4584
4585 //arglist might be preceded by symbol naming this fn
4586 if(nm != null)
4587 {
4588 fn.thisName = nm.name;
4589 form = RT.cons(FN, RT.next(RT.next(form)));
4590 }
4591
4592 //now (fn [args] body...) or (fn ([args] body...) ([args2] body2...) ...)

Callers 1

analyzeSeqMethod · 0.95

Calls 15

internMethod · 0.95
getMethod · 0.95
metaMethod · 0.95
booleanCastMethod · 0.95
secondMethod · 0.95
nextIDMethod · 0.95
getObjectTypeMethod · 0.95
pushThreadBindingsMethod · 0.95
mapUniqueKeysMethod · 0.95
consMethod · 0.95
nextMethod · 0.95
listMethod · 0.95

Tested by

no test coverage detected