Skip to content

Commit 963d083

Browse files
committed
FEAT: allow word!, get-word! and get-path! values inside a call argument
1 parent 39c7e22 commit 963d083

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/core/n-io.c

+10
Original file line numberDiff line numberDiff line change
@@ -819,11 +819,21 @@ static REBSER *Read_All_File(char *fname)
819819
argv = (REBCHR**)SERIES_DATA(ser);
820820
for (i = 0; i < argc; i ++) {
821821
REBVAL *param = VAL_BLK_SKIP(arg, i);
822+
if (IS_GET_WORD(param)) {
823+
param = Get_Var(param);
824+
}
825+
else if (IS_GET_PATH(param)) {
826+
Do_Path(&param, NULL);
827+
param = DS_POP; // volatile stack reference
828+
}
822829
if (IS_FILE(param)) {
823830
REBSER* path = Value_To_OS_Path(param, FALSE);
824831
argv[i] = (REBCHR*)SERIES_DATA(path);
825832
} else if (ANY_STR(param)) {
826833
argv[i] = Val_Str_To_OS(param);
834+
} else if (IS_WORD(param)) {
835+
Set_Series(REB_STRING, D_RET, Copy_Form_Value(param, TRUE));
836+
argv[i] = Val_Str_To_OS(D_RET);
827837
} else {
828838
Trap_Arg(param);
829839
}

src/tests/units/call-test.r3

+11
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ rebol-cmd: func[cmd][
8585
date? transcode/one tmp
8686
]
8787
delete %issue-2582.r3
88+
--test-- "Block input with word!, get-word! and get-path!"
89+
--assert all [
90+
file? try [write %probe-args.r3 {Rebol [] probe system/options/args}]
91+
tmp: clear ""
92+
url: http://example.org
93+
;; not using reduce in this test...
94+
0 = call/wait/output [:system/options/boot %probe-args.r3 :url foo] tmp
95+
["http://example.org" "foo"] = transcode/one tmp
96+
]
97+
delete %probe-args.r3
98+
8899
===end-group===
89100

90101

0 commit comments

Comments
 (0)