commit 4dd01a4ec6df8f5562a0e1de2a9331e1a31494cb
parent b4b19c9afdfe4a384fd71cedd4b2ff6ac47e66f7
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sat, 1 Apr 2023 14:28:41 -0400
halcc: use new &) modifier to simplify
Diffstat:
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/comp/c/expr.fs b/fs/comp/c/expr.fs
@@ -73,12 +73,9 @@ struct[ Result
\ Never changes W, never pushes to PS
: :hal# ( self -- halop ) dup type case ( self )
CONST of = arg i) endof
- CDECL of =
- dup cdecl dup CDecl :halop ( self cdecl halop )
- swap CDecl :reference? if A>) lea, A) &) then ( self halop )
- swap :nb) endof
+ CDECL of = dup cdecl CDecl :halop swap :nb) endof
PS of = arg PSP+) endof
- REF of = target :hal# A>) lea, A) &) endof
+ REF of = target :hal# &) endof
DEREF of =
dup target dup :isW? if :release W) &) else :hal# then ( self halop )
A>) @, A) swap :nb) endof
diff --git a/fs/comp/c/fgen.fs b/fs/comp/c/fgen.fs
@@ -145,7 +145,7 @@ current ' parseStatement realias
dup CDecl :elemsize >r >r \ V1=sz V2=cdecl
dup Stack :count V1 * tuck ( arraysz stack arraysz )
_litarena :[ V1 writeStack _litarena :] ( arraysz a )
- litn r> dup, CDecl :halop lea, litn compile move rdrop ;
+ litn r> dup, CDecl :halop @, litn compile move rdrop ;
: parseDeclLine ( type -- )
parseDeclarator ( cdecl )
diff --git a/fs/comp/c/type.fs b/fs/comp/c/type.fs
@@ -89,7 +89,8 @@ struct[ CDecl
STORAGE_RS of = RSP) swap +) endof
STORAGE_PS of = PSP+) endof
STORAGE_MEM of = m) endof
- _err endcase ( self operand ) nip ;
+ _err endcase ( self operand )
+ swap :reference? if &) then ;
\ Combined size of all fields in the LL.
: :size ( self -- size )