fix primitive types
This commit is contained in:
parent
120e827d32
commit
0ba0a20b99
1 changed files with 19 additions and 1 deletions
|
@ -1126,10 +1126,28 @@ public class ISBPL {
|
||||||
else
|
else
|
||||||
typeError("array", "matching-array");
|
typeError("array", "matching-array");
|
||||||
for (int i = 0 ; i < isbplArray.length ; i++) {
|
for (int i = 0 ; i < isbplArray.length ; i++) {
|
||||||
Array.set(array, i, fromISBPL(isbplArray[i]));
|
Array.set(array, i, fromISBPL(isbplArray[i], expectedType.getComponentType()));
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
if(expectedType.isPrimitive()) {
|
||||||
|
if(expectedType == long.class)
|
||||||
|
return o.toLong();
|
||||||
|
if(expectedType == int.class)
|
||||||
|
return (int) o.toLong();
|
||||||
|
if(expectedType == double.class)
|
||||||
|
return o.toDouble();
|
||||||
|
if(expectedType == float.class)
|
||||||
|
return (float) o.toDouble();
|
||||||
|
if(expectedType == short.class)
|
||||||
|
return (short) o.toLong();
|
||||||
|
if(expectedType == boolean.class)
|
||||||
|
return o.isTruthy();
|
||||||
|
if(expectedType == char.class)
|
||||||
|
return (char) o.toLong();
|
||||||
|
if(expectedType == byte.class)
|
||||||
|
return (byte) o.toLong();
|
||||||
|
}
|
||||||
if(!expectedType.isAssignableFrom(o.object.getClass()))
|
if(!expectedType.isAssignableFrom(o.object.getClass()))
|
||||||
typeError(o.type.name, expectedType.getName());
|
typeError(o.type.name, expectedType.getName());
|
||||||
return o.object;
|
return o.object;
|
||||||
|
|
Loading…
Add table
Reference in a new issue