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

Class InstanceOfExpr

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

Source from the content-addressed store, hash-verified

3933//}
3934
3935public static class InstanceOfExpr implements Expr, MaybePrimitiveExpr{
3936 Expr expr;
3937 Class c;
3938
3939 public InstanceOfExpr(Class c, Expr expr){
3940 this.expr = expr;
3941 this.c = c;
3942 }
3943
3944 public Object eval() {
3945 if(c.isInstance(expr.eval()))
3946 return RT.T;
3947 return RT.F;
3948 }
3949
3950 public boolean canEmitPrimitive(){
3951 return true;
3952 }
3953
3954 public void emitUnboxed(C context, ObjExpr objx, GeneratorAdapter gen){
3955 expr.emit(C.EXPRESSION, objx, gen);
3956 gen.instanceOf(getType(c));
3957 }
3958
3959 public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
3960 emitUnboxed(context,objx,gen);
3961 HostExpr.emitBoxReturn(objx,gen,Boolean.TYPE);
3962 if(context == C.STATEMENT)
3963 gen.pop();
3964 }
3965
3966 public boolean hasJavaClass() {
3967 return true;
3968 }
3969
3970 public Class getJavaClass() {
3971 return Boolean.TYPE;
3972 }
3973
3974}
3975
3976static class StaticInvokeExpr implements Expr, MaybePrimitiveExpr{
3977 public final Type target;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected