Skip to content

Commit

Permalink
autobox int as Integer (note this change is for evaluation only)
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Oct 23, 2011
1 parent b4a2216 commit a2e4d1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/jvm/clojure/lang/Compiler.java
Expand Up @@ -769,8 +769,9 @@ else if(returnType == char.class)
{
if(returnType == int.class)
{
gen.visitInsn(I2L);
gen.invokeStatic(NUMBERS_TYPE, Method.getMethod("Number num(long)"));
gen.invokeStatic(INTEGER_TYPE, intValueOfMethod);
// gen.visitInsn(I2L);
// gen.invokeStatic(NUMBERS_TYPE, Method.getMethod("Number num(long)"));
}
else if(returnType == float.class)
{
Expand Down
16 changes: 10 additions & 6 deletions src/jvm/clojure/lang/Reflector.java
Expand Up @@ -472,7 +472,9 @@ static public boolean paramArgTypeMatch(Class paramType, Class argType){
if(paramType == int.class)
return argType == Integer.class
|| argType == long.class
|| argType == Long.class;// || argType == FixNum.class;
|| argType == Long.class
|| argType == short.class
|| argType == byte.class;// || argType == FixNum.class;
else if(paramType == float.class)
return argType == Float.class
|| argType == double.class;
Expand All @@ -481,7 +483,9 @@ else if(paramType == double.class)
|| argType == float.class;// || argType == DoubleNum.class;
else if(paramType == long.class)
return argType == Long.class
|| argType == int.class;// || argType == BigNum.class;
|| argType == int.class
|| argType == short.class
|| argType == byte.class;// || argType == BigNum.class;
else if(paramType == char.class)
return argType == Character.class;
else if(paramType == short.class)
Expand Down Expand Up @@ -516,10 +520,10 @@ public static Object prepRet(Class c, Object x){
return x;
if(x instanceof Boolean)
return ((Boolean) x)?Boolean.TRUE:Boolean.FALSE;
else if(x instanceof Integer)
{
return ((Integer)x).longValue();
}
// else if(x instanceof Integer)
// {
// return ((Integer)x).longValue();
// }
// else if(x instanceof Float)
// return Double.valueOf(((Float) x).doubleValue());
return x;
Expand Down

0 comments on commit a2e4d1b

Please sign in to comment.