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

docs: enum type + new CLI flags in the language guide

Documents the \`enum Name { Variant, ... }\` syntax and adds
\`--dump-ir\` and \`--use-ast\` to the CLI flag table. Also adds
an integration test covering enum-variant-as-condition and variant
assignment through the full compile pipeline.

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
Claude 2026-04-12 11:39:12 +00:00
parent dbfcb313bc
commit d4daa6d0a9
No known key found for this signature in database
2 changed files with 52 additions and 5 deletions

View file

@ -141,6 +141,27 @@ fn program_with_functions() {
rom::validate_ines(&rom_data).expect("should be valid iNES");
}
#[test]
fn program_with_enums() {
let source = r#"
game "Enums" { mapper: NROM }
enum Direction { Up, Down, Left, Right }
enum Mode { Idle, Running, Jumping }
var dir: u8 = 0
var mode: u8 = 0
on frame {
if button.right { dir = Right }
if button.left { dir = Left }
if dir == Right { mode = Running }
}
start Main
"#;
let rom_data = compile(source);
rom::validate_ines(&rom_data).expect("should be valid iNES");
}
#[test]
fn program_with_inline_asm() {
let source = r#"