Skip to content

Commit 631ad38

Browse files
committed
FEAT: Make map datatype composable in functions
related to: Oldes/Rebol-issues#2685
1 parent c626c76 commit 631ad38

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/core/c-frame.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
** REBOL [R3] Language Interpreter and Run-time Environment
44
**
55
** Copyright 2012 REBOL Technologies
6-
** Copyright 2012-2021 Rebol Open Source Developers
6+
** Copyright 2012-2026 Rebol Open Source Developers
77
** REBOL is a trademark of REBOL Technologies
88
**
99
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -843,7 +843,7 @@
843843
}
844844
}
845845
}
846-
else if ((ANY_BLOCK(value) || IS_MAP(value)) && (mode & BIND_DEEP)) {
846+
else if ((ANY_BLOCK_OR_MAP(value)) && (mode & BIND_DEEP)) {
847847
// Recursion check: (variation of: Find_Same_Block(MOLD_LOOP, value))
848848
for (val = BLK_HEAD(MOLD_LOOP); NOT_END(val); val++) {
849849
if (VAL_SERIES(val) == VAL_SERIES(value)) return;
@@ -963,7 +963,7 @@
963963
VAL_WORD_FRAME(value) = frame; // func body
964964
}
965965
}
966-
else if (ANY_BLOCK(value))
966+
else if (ANY_BLOCK_OR_MAP(value))
967967
Bind_Relative_Words(frame, VAL_SERIES(value));
968968
}
969969
}

src/include/sys-value.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
** REBOL [R3] Language Interpreter and Run-time Environment
44
**
55
** Copyright 2012 REBOL Technologies
6-
** Copyright 2012-2025 Rebol Open Source Contributors
6+
** Copyright 2012-2026 Rebol Open Source Contributors
77
** REBOL is a trademark of REBOL Technologies
88
**
99
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -1383,6 +1383,7 @@ typedef struct Reb_All {
13831383
#define ANY_STR(v) (VAL_TYPE(v) >= REB_STRING && VAL_TYPE(v) <= REB_TAG)
13841384
#define ANY_BINSTR(v) (VAL_TYPE(v) >= REB_BINARY && VAL_TYPE(v) <= REB_TAG)
13851385
#define ANY_BLOCK(v) (VAL_TYPE(v) >= REB_BLOCK && VAL_TYPE(v) <= REB_HASH)
1386+
#define ANY_BLOCK_OR_MAP(v) (VAL_TYPE(v) >= REB_BLOCK && VAL_TYPE(v) <= REB_MAP)
13861387
#define ANY_WORD(v) (VAL_TYPE(v) >= REB_WORD && VAL_TYPE(v) <= REB_ISSUE)
13871388
#define ANY_PATH(v) (VAL_TYPE(v) >= REB_PATH && VAL_TYPE(v) <= REB_LIT_PATH)
13881389
#define ANY_FUNC(v) (VAL_TYPE(v) >= REB_NATIVE && VAL_TYPE(v) <= REB_FUNCTION)

src/tests/units/evaluation-test.r3

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,12 @@ Rebol [
495495
none? m2/c
496496
m2/d/k == white
497497
]
498+
499+
a: 1 f1: func[b][compose #[num: (a + b)]]
500+
--assert #[num: 3] = try [f1 2]
501+
502+
f2: closure/with [b][compose #[num: (a + b)]][a: 1]
503+
--assert #[num: 3] = try [f2 2]
498504

499505
===end-group===
500506

0 commit comments

Comments
 (0)