diff options
| author | Thomas Voss <mail@thomasvoss.com> | 2026-03-10 17:40:53 +0100 |
|---|---|---|
| committer | Thomas Voss <mail@thomasvoss.com> | 2026-03-10 17:40:53 +0100 |
| commit | 81d1341b34bd2a09552a08ffe9a12147c2abb6e4 (patch) | |
| tree | e05ef395d2484f4178376b6c5443d25289ccd358 /oryxc | |
| parent | 2cb3026528aa963262b12fbd02d49f8bbc8e2ce8 (diff) | |
Ensure the final function param has a type
Diffstat (limited to 'oryxc')
| -rw-r--r-- | oryxc/src/parser.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/oryxc/src/parser.rs b/oryxc/src/parser.rs index 86d7b3d..629b290 100644 --- a/oryxc/src/parser.rs +++ b/oryxc/src/parser.rs @@ -542,6 +542,15 @@ impl<'a> Parser<'a> { self.next(); /* Consume ‘(’ */ return self.scratch_guard(|p| { let lhs = p.parse_decl_list()?; + if let Some(&ty) = p.scratch[lhs..].last() { + if ty == u32::MAX { + let i = p.scratch.len() as u32 - 2; + return Err(OryxError::new( + p.get_view_at(i), + "function parameter has no declared type", + )); + } + } if p.get_n_move() != TokenType::ParenR { /* TODO: Highlight the entire argument list */ |