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

Class MetaExpr

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

Source from the content-addressed store, hash-verified

3185}
3186
3187public static class MetaExpr implements Expr{
3188 public final Expr expr;
3189 public final Expr meta;
3190 final static Type IOBJ_TYPE = Type.getType(IObj.class);
3191 final static Method withMetaMethod = Method.getMethod("clojure.lang.IObj withMeta(clojure.lang.IPersistentMap)");
3192
3193
3194 public MetaExpr(Expr expr, Expr meta){
3195 this.expr = expr;
3196 this.meta = meta;
3197 }
3198
3199 public Object eval() {
3200 return ((IObj) expr.eval()).withMeta((IPersistentMap) meta.eval());
3201 }
3202
3203 public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
3204 expr.emit(C.EXPRESSION, objx, gen);
3205 gen.checkCast(IOBJ_TYPE);
3206 meta.emit(C.EXPRESSION, objx, gen);
3207 gen.checkCast(IPERSISTENTMAP_TYPE);
3208 gen.invokeInterface(IOBJ_TYPE, withMetaMethod);
3209 if(context == C.STATEMENT)
3210 {
3211 gen.pop();
3212 }
3213 }
3214
3215 public boolean hasJavaClass() {
3216 return expr.hasJavaClass();
3217 }
3218
3219 public Class getJavaClass() {
3220 return expr.getJavaClass();
3221 }
3222}
3223
3224public static class IfExpr implements Expr, MaybePrimitiveExpr{
3225 public final Expr testExpr;

Callers

nothing calls this directly

Calls 2

getTypeMethod · 0.95
getMethodMethod · 0.95

Tested by

no test coverage detected