Checks if the expression can be cast to the specified type. @param castType type to cast to @return result of check or null
(final SeqType castType)
| 59 | * @return result of check or {@code null} |
| 60 | */ |
| 61 | final Boolean castable(final SeqType castType) { |
| 62 | final SeqType est = expr.seqType(); |
| 63 | if(!est.mayBeWrapped()) { |
| 64 | final long es = expr.size(); |
| 65 | if(es != -1 && (es < castType.occ.min || es > castType.occ.max)) return false; |
| 66 | |
| 67 | final Type et = est.type; |
| 68 | if(et.instanceOf(castType.type) && est.occ.instanceOf(castType.occ) && |
| 69 | (et.eq(castType.type) || castType.type == BasicType.NUMERIC)) return true; |
| 70 | } |
| 71 | return null; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Checks if the argument can be simplified. |
no test coverage detected