Skip to content

Commit 8892f7d

Browse files
committed
FIX: make event! using existing event! as a make type
resolves: Oldes/Rebol-issues#2484
1 parent 9b44c08 commit 8892f7d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/core/t-event.c

+3-5
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,8 @@
379379
value = D_ARG(1);
380380
arg = D_ARG(2);
381381

382-
if (action == A_MAKE) {
383-
// Clone an existing event?
384-
if (IS_EVENT(value)) return R_ARG1;
385-
else if (IS_DATATYPE(value)) {
382+
if (action == A_MAKE || action == A_TO) {
383+
if (IS_EVENT(value) || IS_DATATYPE(value)) {
386384
if (IS_EVENT(arg)) return R_ARG2;
387385
//Trap_Make(REB_EVENT, value);
388386
VAL_SET(D_RET, REB_EVENT);
@@ -392,7 +390,7 @@
392390
is_arg_error:
393391
Trap_Types(RE_EXPECT_VAL, REB_EVENT, VAL_TYPE(arg));
394392

395-
// Initialize GOB from block:
393+
// Initialize event from block:
396394
if (IS_BLOCK(arg)) Set_Event_Vars(D_RET, VAL_BLK_DATA(arg));
397395
else goto is_arg_error;
398396
}

src/tests/units/event-test.r3

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Rebol [
1414
;@@ https://github.com/Oldes/Rebol-issues/issues/132
1515
--assert event? e: make event! [type: 'connect]
1616
--assert 'connect = e/type
17+
;@@ https://github.com/Oldes/Rebol-issues/issues/2484
18+
--assert all [event? e2: make e [offset: 0x0] e2/offset = 0x0]
1719

1820
--test-- "event! offset out of range"
1921
;@@ https://github.com/Oldes/Rebol-issues/issues/1635

0 commit comments

Comments
 (0)