From: Phil Burk Date: Sun, 13 Sep 2020 19:50:46 +0000 (-0700) Subject: Merge pull request #79 from philburk/fix20 X-Git-Url: http://git.subgeniuskitty.com/pforth/.git/commitdiff_plain/7260a8255869f3c801885a8a74315536f709bae9?hp=e476e087a64494c5965330887a248069c69e706e Merge pull request #79 from philburk/fix20 Simplify VALUE --- diff --git a/fth/ansilocs.fth b/fth/ansilocs.fth index 3423bfc..923eef2 100644 --- a/fth/ansilocs.fth +++ b/fth/ansilocs.fth @@ -139,19 +139,11 @@ if.forgotten lv.term THEN ; - : VALUE CREATE ( n ) , - immediate DOES> - state @ - IF - [compile] aliteral - compile @ - ELSE - @ - THEN + @ ; : TO ( val -- ) @@ -161,7 +153,7 @@ if.forgotten lv.term lv.compile.store ELSE find - 1 = 0= abort" TO or -> before non-local or non-value" + 0= abort" not found" >body \ point to data state @ IF \ compiling ( -- pfa ) @@ -183,7 +175,7 @@ if.forgotten lv.term [compile] literal compile (local+!) ELSE find - 1 = 0= abort" +-> before non-local or non-value" + 0= abort" not found" >body \ point to data state @ IF \ compiling ( -- pfa ) diff --git a/fth/t_locals.fth b/fth/t_locals.fth index 5cec9e0..0384ee2 100644 --- a/fth/t_locals.fth +++ b/fth/t_locals.fth @@ -14,6 +14,7 @@ test{ T{ 333 value my-value my-value }T{ 333 }T T{ 1000 -> my-value my-value }T{ 1000 }T T{ 35 +-> my-value my-value }T{ 1035 }T +T{ 987 to my-value my-value }T{ 987 }T : test.value ( -- ok ) 100 -> my-value my-value 100 = @@ -22,6 +23,11 @@ T{ 35 +-> my-value my-value }T{ 1035 }T ; T{ test.value }T{ TRUE }T +\ test compile time behavior of a VALUE +567 value VAL3 immediate +: VD3 val3 literal ; +T{ vd3 }T{ 567 }T + \ test locals in a word : test.locs { aa bb | cc -- ok } cc 0=