Parse a function body; the caller will parse the surrounding "{}" { [type arg,] -> expr } { expr } // The no-argument function
()
| 1364 | if( !(val._type instanceof TypeInteger tval && t instanceof TypeInteger t0 && !tval.isa(t0)) ) { |
| 1365 | if( !(val._type instanceof TypeFloat tval && t instanceof TypeFloat t0 && !tval.isa(t0)) ) |
| 1366 | return val; |
| 1367 | // Float rounding |
| 1368 | return peep(new RoundF32Node(val)); |
| 1369 | } |
| 1370 | if( t0._min==0 ) // Unsigned |
| 1371 | return peep(new AndNode(null,val,con(t0._max))); |
| 1372 | // Signed extension |
| 1373 | int shift = Long.numberOfLeadingZeros(t0._max)-1; |
| 1374 | Node shf = con(shift); |
| 1375 | if( shf._type==TypeInteger.ZERO ) |
| 1376 | return val; |
| 1377 | return peep(new SarNode(null,peep(new ShlNode(null,val,shf.keep())),shf.unkeep())); |
| 1378 | } |
| 1379 | |
| 1380 | /** |
| 1381 | * Parse a function body; the caller will parse the surrounding "{}" |
| 1382 | * |
| 1383 | * <pre> |
| 1384 | * { [type arg,]* -> expr } |
| 1385 | * { expr } // The no-argument function |
| 1386 | * </pre> |
| 1387 | */ |
no test coverage detected