From 04678ca80941b8047576f2b1892fcd823d0647ac Mon Sep 17 00:00:00 2001 From: Cat's Eye Technologies Date: Sat, 12 Apr 2014 21:27:04 +0100 Subject: [PATCH] Block-level decls are visible in inner blocks. --- doc/Checking.markdown | 25 +++++++++++++++++++++++++ eg/game.60p | 4 +--- src/SixtyPical/Transformer.hs | 12 +++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/doc/Checking.markdown b/doc/Checking.markdown index 05bcba8..807d91e 100644 --- a/doc/Checking.markdown +++ b/doc/Checking.markdown @@ -241,6 +241,31 @@ Even in inner blocks. | } ? undeclared location +Block-level declarations are visible in inner blocks. + + | routine main { + | reserve byte lives + | with sei { + | if beq { + | lda #3 + | repeat bne { + | sta lives + | } + | } else { + | sta lives + | } + | } + | } + = True + +A block-level `reserve` may not supply an initial value. + + | routine main { + | reserve byte lives : 3 + | lda lives + | } + ? block-level 'lives' cannot supply initial value + All routines jsr'ed to must be defined, or external. | routine main { diff --git a/eg/game.60p b/eg/game.60p index 4f2dcd0..4ebb98c 100644 --- a/eg/game.60p +++ b/eg/game.60p @@ -33,8 +33,6 @@ reserve vector dispatch_state reserve byte[18] press_fire_msg: "PRESS FIRE TO PLAY" -reserve byte save_x // TODO: SHOULD BE BLOCK LOCAL! - routine calculate_new_position outputs (new_position) { clc lda