| 376 | } |
| 377 | |
| 378 | Method parseMethod() { |
| 379 | Method method; |
| 380 | method.line = token_.line; |
| 381 | method.retType = expect(Tok::Ident, "return type").text; |
| 382 | method.name = expect(Tok::Ident, "method name").text; |
| 383 | expect(Tok::LParen); |
| 384 | std::unordered_set<std::string> names; |
| 385 | if (token_.kind != Tok::RParen) { |
| 386 | for (;;) { |
| 387 | Field field = parseField(true); |
| 388 | ensureUnique(names, field.name, "method parameter", field.line); |
| 389 | method.params.push_back(std::move(field)); |
| 390 | if (token_.kind != Tok::Comma) break; |
| 391 | advance(); |
| 392 | } |
| 393 | } |
| 394 | expect(Tok::RParen); |
| 395 | expect(Tok::Semi); |
| 396 | return method; |
| 397 | } |
| 398 | |
| 399 | Field parseField(bool allowDirection) { |
| 400 | Field field; |
nothing calls this directly
no outgoing calls
no test coverage detected