mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-04 04:50:22 +00:00
Fix _RGB32() optional arguments
The new optional arguments for functions broke _RGB32() because it uses some custom flags ('overloaded' and 'minargs' on the id Type) to control its parameter passing. You are allowed passing any number from 1 to 4 args to `func__rgb32` and there are 4 overloaded C++ functions that will get picked from. This is different from how this typically would work, with all 4 parameters always passed and an extra argument to specify the parameters that were passed. Rather than change `func__rgb32` I simply adjusted the optional argument logic to account for the flags used by `_RGB32()` - if the `overloaded` flag is set, then we don't need to add extra `NULL` parameters for any parameter that wasn't specified in the argument list. Instead we simply don't emit anything for those.
This commit is contained in:
parent
a7ab521c91
commit
e810229d11
|
@ -17783,7 +17783,9 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
|
|||
NEXT
|
||||
|
||||
' Add on any extra optional arguments that were not provided
|
||||
IF curarg <= id2.args THEN
|
||||
'
|
||||
' Overloaded functions do not require the omited arguments to be provided
|
||||
IF curarg <= id2.args AND NOT id2.overloaded THEN
|
||||
FOR i = curarg TO id2.args
|
||||
IF i = 1 THEN r$ = r$ + "NULL" ELSE r$ = r$ + ",NULL"
|
||||
NEXT
|
||||
|
|
8
tests/compile_tests/colors/test.bas
Normal file
8
tests/compile_tests/colors/test.bas
Normal file
|
@ -0,0 +1,8 @@
|
|||
$Console:Only
|
||||
|
||||
Print "Grey, max alpha: "; Hex$(_RGB32(&H7F))
|
||||
Print "Grey, half alpha: "; Hex$(_RGB32(&H7F, &H7F))
|
||||
Print "Grey, max alpha: "; Hex$(_RGB32(&H7F, &H7F, &H7F))
|
||||
Print "Grey, half alpha: "; Hex$(_RGB32(&H7F, &H7F, &H7F, &H7F))
|
||||
|
||||
System
|
4
tests/compile_tests/colors/test.output
Normal file
4
tests/compile_tests/colors/test.output
Normal file
|
@ -0,0 +1,4 @@
|
|||
Grey, max alpha: FF7F7F7F
|
||||
Grey, half alpha: 7F7F7F7F
|
||||
Grey, max alpha: FF7F7F7F
|
||||
Grey, half alpha: 7F7F7F7F
|
Loading…
Reference in a new issue