Skip to content

Commit 65878e1

Browse files
committed
FIX: do not expecting a Rebol header when input is a string value
resolves: Oldes/Rebol-issues#2596
1 parent 8f7e0de commit 65878e1

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/mezz/sys-base.reb

+9-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ do*: func [
4646
; Currently, load of URL has no special block forms.
4747

4848
; Load the data, first so it will error before change-dir
49-
data: load/header/as value 'unbound ; unbound so DO-NEEDS runs before INTERN
50-
; Get the header and advance 'data to the code position
51-
hdr: first+ data ; object or none
52-
; data is a block! here, with the header object in the first position back
53-
mod?: 'module = select hdr 'type
49+
either string? value [
50+
data: load/all/as value 'unbound ; does not evaluate REBOL header
51+
][
52+
data: load/header/as value 'unbound ; unbound so DO-NEEDS runs before INTERN
53+
; Get the header and advance 'data to the code position
54+
hdr: first+ data ; object or none
55+
; data is a block! here, with the header object in the first position back
56+
mod?: 'module = select hdr 'type
57+
]
5458

5559
either all [string? value not mod?] [
5660
; Return result without script overhead

src/tests/units/evaluation-test.r3

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ Rebol [
9090
;@@ https://github.com/Oldes/Rebol-issues/issues/903
9191
--assert all [error? e: try [do "<> 0"] e/id = 'missing-arg]
9292
--assert all [error? e: try [do next [1 <> 0]] e/id = 'missing-arg]
93+
94+
--test-- "do string with Rebol header"
95+
;@@ https://github.com/Oldes/Rebol-issues/issues/2596
96+
--assert "Rebol []" == do "{Rebol []}"
97+
--assert "^/Rebol []" == try [do "{^/Rebol []}"]
9398

9499
===end-group===
95100

0 commit comments

Comments
 (0)