* source/compiler/harbour.sly
! Optimized __GETA() support, and changed it to be implementated identical to Clipper.
/* Clipper passed a bGet Block which refrences the Base Array Variable and not the Variable itself.
Clipper passes NIL instead of bGet block if the Base Array is MACROVAR or MACROTEXT.
Clipper does not optimize "&Macro" to Macro, but Harbour does! */
* source/rtl/tgetint.prg
* __GETA() Changed 1st parameter aVar to bGetArray and logic to get the Base Array if bGetArray is NIL
/* Optimized to not use macro if possible (most cases) even if the GetArray is a macro. */
* tests/testget.prg
+ Added additional test.
36 lines
914 B
Plaintext
36 lines
914 B
Plaintext
Procedure Main()
|
|
|
|
LOCAL GetList := {}, cVar := "Hello"
|
|
MEMVAR aVar, nIndex, cMacro
|
|
PRIVATE aVar := { "World", "Again" }, nIndex := 1, cMacro := "cEarly", cEarly := {"Early"}, cLate := "Late!", cEarly2 := {"Early2"}
|
|
|
|
CLS
|
|
|
|
? "2nd GET should say 'Early'."
|
|
|
|
@ 10,10 SAY "cVar :" GET cVar PICTURE "@K!"
|
|
@ 12,10 SAY "cMacro[1] :" GET &cMacro[1]
|
|
@ 14,10 SAY "cMacro.2[1] :" GET &cMacro.2[1]
|
|
@ 16,10 SAY "cEarly[1] :" GET cEarly[1]
|
|
//@ 14,10 SAY "cMacro :" GET &(cMacro)[1]
|
|
nIndex := 2
|
|
@ 18,10 SAY "aVar :" GET aVar[nIndex]
|
|
@ 20,10 SAY "Picture of GET-1:" GET GetList[1]:Picture
|
|
nIndex := 3
|
|
cMacro := "cLate"
|
|
READ
|
|
|
|
CLS
|
|
|
|
/* Clipper Error "Get contains complex macro"
|
|
? "This GET should say 'Late!'."
|
|
cMacro := "cEarly"
|
|
@ 10,10 SAY "cMacro :" GET &(cMacro)
|
|
cMacro := "cLate"
|
|
READ
|
|
*/
|
|
|
|
RETURN
|
|
|
|
|