Parse a function body; the caller will parse the surrounding "{}" { [type arg,] -> expr } { expr } // The no-argument function
()
| 1344 | * </pre> |
| 1345 | */ |
| 1346 | private Node func() { |
| 1347 | Ary<Type> ts = new Ary<>(Type.class); |
| 1348 | Ary<String> ids = new Ary<>(String.class); |
| 1349 | _lexer.skipWhiteSpace(); |
| 1350 | Lexer loc = loc(); // First argument location |
| 1351 | while( true ) { |
| 1352 | Type t = type(); // Arg type |
| 1353 | if( t==null ) break; |
| 1354 | String id = requireId(); |
| 1355 | ts .push(t ); // Push type/arg pairs |
| 1356 | ids.push(id); |
| 1357 | match(","); |
| 1358 | } |
| 1359 | require("->"); |
| 1360 | // Make a concrete function type, with a fidx |
| 1361 | TypeFunPtr tfp = _code.makeFun(TypeTuple.make(ts.asAry()),Type.BOTTOM); |
| 1362 | ReturnNode ret = parseFunctionBody(tfp,loc,ids.asAry()); |
| 1363 | return con(ret._fun.sig()); |
| 1364 | } |
| 1365 | |
| 1366 | /** |
| 1367 | * Parse function call arguments; caller will parse the surrounding "()" |
no test coverage detected