| 301 | |
| 302 | // Java box ints and floats. Other things can just be null or some informative string |
| 303 | private static Object con( Type t ) { |
| 304 | return switch ( t ) { |
| 305 | case TypeInteger i -> i.isConstant() ? (Long )i.value() : "INT"; |
| 306 | case TypeFloat f -> f.isConstant() ? (Double)f.value() : "FLT"; |
| 307 | case TypeFunPtr tfp -> tfp; |
| 308 | case TypeMem mem -> "MEM"; |
| 309 | case TypeMemPtr tmp -> { |
| 310 | if( tmp._obj.isAry() ) { // Constant array ptr |
| 311 | TypeConAry con = (TypeConAry)tmp._obj.field("[]")._t; |
| 312 | Object[] xs = new Object[con.len()]; |
| 313 | for( int i=0; i<con.len(); i++ ) |
| 314 | xs[i] = con.at8(i); |
| 315 | yield xs; |
| 316 | |
| 317 | } else { |
| 318 | throw Utils.TODO(); // Constant non-array ptr |
| 319 | } |
| 320 | } |
| 321 | default -> null; |
| 322 | }; |
| 323 | } |
| 324 | |
| 325 | // Convert array size to array element count |
| 326 | private static int offToIdx( long off, TypeStruct t) { |