1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 08:55:38 +00:00

Parser: E0505 error on multiple 'start' declarations

Previously a second \`start X\` statement silently overrode the first.
Now emits E0505 at parse time.

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
Claude 2026-04-12 10:59:06 +00:00
parent 814cbe54bd
commit 4e05c008ce
No known key found for this signature in database
3 changed files with 24 additions and 1 deletions

View file

@ -163,8 +163,16 @@ impl Parser {
on_frame = Some(self.parse_on_frame()?);
}
TokenKind::KwStart => {
let kw_span = self.current_span();
self.advance();
let (name, _) = self.expect_ident()?;
if start_state.is_some() {
return Err(Diagnostic::error(
ErrorCode::E0505,
"multiple 'start' declarations",
kw_span,
));
}
start_state = Some(name);
}
_ => {