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

Class RecurExpr

src/jvm/clojure/lang/Compiler.java:7136–7311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7134}
7135
7136public static class RecurExpr implements Expr, MaybePrimitiveExpr{
7137 public final IPersistentVector args;
7138 public final IPersistentVector loopLocals;
7139 final int line;
7140 final int column;
7141 final String source;
7142
7143
7144 public RecurExpr(IPersistentVector loopLocals, IPersistentVector args, int line, int column, String source){
7145 this.loopLocals = loopLocals;
7146 this.args = args;
7147 this.line = line;
7148 this.column = column;
7149 this.source = source;
7150 }
7151
7152 public Object eval() {
7153 throw new UnsupportedOperationException("Can't eval recur");
7154 }
7155
7156 public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
7157 Label loopLabel = (Label) LOOP_LABEL.deref();
7158 if(loopLabel == null)
7159 throw new IllegalStateException();
7160 for(int i = 0; i < loopLocals.count(); i++)
7161 {
7162 LocalBinding lb = (LocalBinding) loopLocals.nth(i);
7163 Expr arg = (Expr) args.nth(i);
7164 if(lb.getPrimitiveType() != null)
7165 {
7166 Class primc = lb.getPrimitiveType();
7167 final Class pc = maybePrimitiveType(arg);
7168 if(pc == primc)
7169 ((MaybePrimitiveExpr) arg).emitUnboxed(C.EXPRESSION, objx, gen);
7170 else if(primc == long.class && pc == int.class)
7171 {
7172 ((MaybePrimitiveExpr) arg).emitUnboxed(C.EXPRESSION, objx, gen);
7173 gen.visitInsn(I2L);
7174 }
7175 else if(primc == double.class && pc == float.class)
7176 {
7177 ((MaybePrimitiveExpr) arg).emitUnboxed(C.EXPRESSION, objx, gen);
7178 gen.visitInsn(F2D);
7179 }
7180 else if(primc == int.class && pc == long.class)
7181 {
7182 ((MaybePrimitiveExpr) arg).emitUnboxed(C.EXPRESSION, objx, gen);
7183 gen.invokeStatic(RT_TYPE, Method.getMethod("int intCast(long)"));
7184 }
7185 else if(primc == float.class && pc == double.class)
7186 {
7187 ((MaybePrimitiveExpr) arg).emitUnboxed(C.EXPRESSION, objx, gen);
7188 gen.visitInsn(D2F);
7189 }
7190 else
7191 {
7192// if(true)//RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
7193 throw new IllegalArgumentException

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected