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

Method emit

src/jvm/clojure/lang/Compiler.java:3572–3597  ·  view source on GitHub ↗
(C context, ObjExpr objx, GeneratorAdapter gen)

Source from the content-addressed store, hash-verified

3570 }
3571
3572 public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
3573 boolean allKeysConstant = true;
3574 boolean allConstantKeysUnique = true;
3575 IPersistentSet constantKeys = PersistentHashSet.EMPTY;
3576 for(int i = 0; i < keyvals.count(); i+=2)
3577 {
3578 Expr k = (Expr) keyvals.nth(i);
3579 if(k instanceof LiteralExpr)
3580 {
3581 Object kval = k.eval();
3582 if (constantKeys.contains(kval))
3583 allConstantKeysUnique = false;
3584 else
3585 constantKeys = (IPersistentSet)constantKeys.cons(kval);
3586 }
3587 else
3588 allKeysConstant = false;
3589 }
3590 MethodExpr.emitArgsAsArray(keyvals, objx, gen);
3591 if((allKeysConstant && allConstantKeysUnique) || (keyvals.count() <= 2))
3592 gen.invokeStatic(RT_TYPE, mapUniqueKeysMethod);
3593 else
3594 gen.invokeStatic(RT_TYPE, mapMethod);
3595 if(context == C.STATEMENT)
3596 gen.pop();
3597 }
3598
3599 public boolean hasJavaClass() {
3600 return true;

Callers

nothing calls this directly

Calls 8

evalMethod · 0.95
containsMethod · 0.95
emitArgsAsArrayMethod · 0.95
countMethod · 0.65
nthMethod · 0.65
consMethod · 0.65
popMethod · 0.65
invokeStaticMethod · 0.45

Tested by

no test coverage detected