mirror of
https://github.com/imjasonh/nescript
synced 2026-07-08 17:06:04 +00:00
Sprite resolution, asset wiring, shift-assign, unreachable state warning
Sprite/asset pipeline: - Linker::link_with_assets() places sprite CHR data in ROM at correct tile - assets::resolve_sprites() walks Program for inline sprite bytes - CodeGen::with_sprites() maps sprite names to tile indices - gen_draw() uses correct tile index from sprite declarations - main.rs wires the full resolution pipeline Shift-assign operators (<<= and >>=): - AssignOp::ShiftLeftAssign and ShiftRightAssign variants - Parser handles in both statement and array index contexts - Codegen emits ASL A / LSR A - IR lowering maps to ShiftLeft/ShiftRight ops Unreachable state warning (W0104): - BFS from start state finds reachable states via transitions - States not reached produce W0104 warning Error polish helpers: - suggest_var_name() for "did you mean" suggestions - emit_undefined_var() for E0502 with typo hints - Used by analyzer for better diagnostics 242 tests pass, clippy clean. https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
parent
5d2d242520
commit
6430c3a935
13 changed files with 737 additions and 17 deletions
|
|
@ -963,6 +963,26 @@ impl Parser {
|
|||
start,
|
||||
))
|
||||
}
|
||||
TokenKind::ShiftLeftAssign => {
|
||||
self.advance();
|
||||
let value = self.parse_expr()?;
|
||||
Ok(Statement::Assign(
|
||||
LValue::Var(name),
|
||||
AssignOp::ShiftLeftAssign,
|
||||
value,
|
||||
start,
|
||||
))
|
||||
}
|
||||
TokenKind::ShiftRightAssign => {
|
||||
self.advance();
|
||||
let value = self.parse_expr()?;
|
||||
Ok(Statement::Assign(
|
||||
LValue::Var(name),
|
||||
AssignOp::ShiftRightAssign,
|
||||
value,
|
||||
start,
|
||||
))
|
||||
}
|
||||
TokenKind::LBracket => {
|
||||
// Array index assignment: name[index] = value
|
||||
self.advance();
|
||||
|
|
@ -1027,6 +1047,14 @@ impl Parser {
|
|||
self.advance();
|
||||
Ok(AssignOp::CaretAssign)
|
||||
}
|
||||
TokenKind::ShiftLeftAssign => {
|
||||
self.advance();
|
||||
Ok(AssignOp::ShiftLeftAssign)
|
||||
}
|
||||
TokenKind::ShiftRightAssign => {
|
||||
self.advance();
|
||||
Ok(AssignOp::ShiftRightAssign)
|
||||
}
|
||||
_ => Err(Diagnostic::error(
|
||||
ErrorCode::E0201,
|
||||
format!("expected assignment operator, found '{}'", self.peek()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue