Open antis81 opened 3 years ago
(Referring to current "dev" branch here.) Should macro parameters (assignments in braces) in bass be treated just like macro-local references?
ACME example (suitable as a test):
!macro inc_store ~.var, ~.call { ;no braces in ACME .var = .var+1 ;var_1 = 43 jsr .call } ;zeropage !section "zp", start=0x0 *=0x2 stored_result: !byte 0 !section "calls", start=0x1234 var_1 = 42 call: .store: lda #var_1 sta stored_result rts ; start of program !section "code", start=* inc_store(var_1, call.store) ;-> stored_result = 43 ; do something with stored_result inc_store(var_1, call.store) ;-> stored_result = 44 ; do more with stored_result
Can't we treat all macro parameters by reference and as well imply those are macro-local?
by reference
Macro in bass according to the above example:
!macro inc_store(var, call) { ; defines: ; __macro_0.var = ~var_1 ; reference to global label ; __macro_0.call = ~call.store .var = .var+1 ;var_1 = var_1+1 -> breaks the "__macro_0" scope) jsr .call }
:bulb: This can solve/replace the "shadowed symbol" list (solve it for good!?). :bulb: The main issue is with global labels inside macros producing unwanted side effects (e.g. overwrite the __macro_<ID> label).
__macro_<ID>
(Referring to current "dev" branch here.) Should macro parameters (assignments in braces) in bass be treated just like macro-local references?
ACME example (suitable as a test):
Can't we treat all macro parameters
by reference
and as well imply those are macro-local?Macro in bass according to the above example:
:bulb: This can solve/replace the "shadowed symbol" list (solve it for good!?). :bulb: The main issue is with global labels inside macros producing unwanted side effects (e.g. overwrite the
__macro_<ID>
label).