Description |
FUNCTION and CLOSURE currently assume that /local is the last refinement. This isn't necessarily the case; it's possible to have other refinements after /local, and this is sometimes done by people who want to have hidden function options. But these generators just append the collected words onto the function spec, assuming that they will be added to the set that goes with /local. Until/if #2108 is implemented, this should be considered a problem.
Instead of appending the words, insert them between /local and the next refinement or the tail, whichever is found first. Or right after /local, if that's more efficient to find. Since /local is never supposed to be called (see #2108) the order or position of the words in the /local section shouldn't matter.
Affects FUNCTION and CLOSURE.
|
Example code |
; Current behavior
>> print mold function [/local a /hidden] [b: 1]
make function! [[/local a /hidden b][b: 1]]
; Desired behavior, insert at next refinement proposal
>> print mold function [/local a /hidden] [b: 1]
make function! [[/local a b /hidden][b: 1]]
; Desired behavior, insert after /local proposal
>> print mold function [/local a /hidden] [b: 1]
make function! [[/local b a /hidden][b: 1]]
|