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

Class HostExpr

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

Source from the content-addressed store, hash-verified

808}
809
810static public abstract class HostExpr implements Expr, MaybePrimitiveExpr{
811 final static Type BOOLEAN_TYPE = Type.getType(Boolean.class);
812 final static Type CHAR_TYPE = Type.getType(Character.class);
813 final static Type INTEGER_TYPE = Type.getType(Integer.class);
814 final static Type LONG_TYPE = Type.getType(Long.class);
815 final static Type FLOAT_TYPE = Type.getType(Float.class);
816 final static Type DOUBLE_TYPE = Type.getType(Double.class);
817 final static Type SHORT_TYPE = Type.getType(Short.class);
818 final static Type BYTE_TYPE = Type.getType(Byte.class);
819 final static Type NUMBER_TYPE = Type.getType(Number.class);
820
821 final static Method charValueMethod = Method.getMethod("char charValue()");
822 final static Method booleanValueMethod = Method.getMethod("boolean booleanValue()");
823
824 final static Method charValueOfMethod = Method.getMethod("Character valueOf(char)");
825 final static Method intValueOfMethod = Method.getMethod("Integer valueOf(int)");
826 final static Method longValueOfMethod = Method.getMethod("Long valueOf(long)");
827 final static Method floatValueOfMethod = Method.getMethod("Float valueOf(float)");
828 final static Method doubleValueOfMethod = Method.getMethod("Double valueOf(double)");
829 final static Method shortValueOfMethod = Method.getMethod("Short valueOf(short)");
830 final static Method byteValueOfMethod = Method.getMethod("Byte valueOf(byte)");
831
832 final static Method intValueMethod = Method.getMethod("int intValue()");
833 final static Method longValueMethod = Method.getMethod("long longValue()");
834 final static Method floatValueMethod = Method.getMethod("float floatValue()");
835 final static Method doubleValueMethod = Method.getMethod("double doubleValue()");
836 final static Method byteValueMethod = Method.getMethod("byte byteValue()");
837 final static Method shortValueMethod = Method.getMethod("short shortValue()");
838
839 final static Method fromIntMethod = Method.getMethod("clojure.lang.Num from(int)");
840 final static Method fromLongMethod = Method.getMethod("clojure.lang.Num from(long)");
841 final static Method fromDoubleMethod = Method.getMethod("clojure.lang.Num from(double)");
842
843
844 //*
845 public static void emitBoxReturn(ObjExpr objx, GeneratorAdapter gen, Class returnType){
846 if(returnType.isPrimitive())
847 {
848 if(returnType == boolean.class)
849 {
850 Label falseLabel = gen.newLabel();
851 Label endLabel = gen.newLabel();
852 gen.ifZCmp(GeneratorAdapter.EQ, falseLabel);
853 gen.getStatic(BOOLEAN_OBJECT_TYPE, "TRUE", BOOLEAN_OBJECT_TYPE);
854 gen.goTo(endLabel);
855 gen.mark(falseLabel);
856 gen.getStatic(BOOLEAN_OBJECT_TYPE, "FALSE", BOOLEAN_OBJECT_TYPE);
857// NIL_EXPR.emit(C.EXPRESSION, fn, gen);
858 gen.mark(endLabel);
859 }
860 else if(returnType == void.class)
861 {
862 NIL_EXPR.emit(C.EXPRESSION, objx, gen);
863 }
864 else if(returnType == char.class)
865 {
866 gen.invokeStatic(CHAR_TYPE, charValueOfMethod);
867 }

Callers

nothing calls this directly

Calls 2

getTypeMethod · 0.95
getMethodMethod · 0.95

Tested by

no test coverage detected