Skip to content

Commit

Permalink
CHANGE: renamed module's local context from local-lib to lib-local
Browse files Browse the repository at this point in the history
So it is consistent with existing `lib-base` and `lib-file`, which are also there.

Related to: Oldes/Rebol-wishes#13
  • Loading branch information
Oldes committed Feb 9, 2021
1 parent 500d3da commit d352af0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/mezz/sys-base.reb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ make-module*: func [
if find spec/options 'extension [
append obj 'lib-base ; specific runtime values MUST BE FIRST
]
append obj 'local-lib ; local import library for the module
append obj 'lib-local ; local import library for the module

unless spec/type [spec/type: 'module] ; in case not set earlier

Expand Down Expand Up @@ -184,7 +184,7 @@ make-module*: func [
]

bind body obj
obj/local-lib: any [mixins make object! 0] ; always set, always overrides
obj/lib-local: any [mixins make object! 0] ; always set, always overrides
if block? hidden [protect/hide/words hidden]
obj: to module! reduce [spec obj]
do body
Expand Down
2 changes: 1 addition & 1 deletion src/mezz/sys-start.reb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ start: func [

;-- Make the user's global context:
tmp: make object! 320
append tmp reduce ['system :system 'local-lib :tmp]
append tmp reduce ['system :system 'lib-local :tmp]
system/contexts/user: tmp

boot-print ["Checking for user.reb file in" home]
Expand Down
24 changes: 12 additions & 12 deletions src/tests/units/module-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ supplement system/options/module-paths join what-dir %units/files/
--test-- "hidden"
;@@ https://github.com/Oldes/Rebol-issues/issues/1696
--assert all [
[local-lib a] = words-of m: module [] [a: 1]
[lib-local a] = words-of m: module [] [a: 1]
m/a = 1
]
--assert all [
[local-lib b] = words-of m: module [] [hidden a: 1 b: does[a + 1]]
[lib-local b] = words-of m: module [] [hidden a: 1 b: does[a + 1]]
error? try [m/a]
m/b = 2
]
Expand Down Expand Up @@ -283,8 +283,8 @@ probe all [
--assert module? m: try [import/version m-1687 1.0.0]
--assert all [
;@@ https://github.com/Oldes/Rebol-wishes/issues/13
object? m/local-lib
empty? m/local-lib ; because there was no import in this module
object? m/lib-local
empty? m/lib-local ; because there was no import in this module
]

--test-- "import/check"
Expand Down Expand Up @@ -324,8 +324,8 @@ probe all [
--assert true? test-needs-file-result
--assert all [
;@@ https://github.com/Oldes/Rebol-wishes/issues/13
object? m/local-lib
m/local-lib/test-needs-file-value = 42 ; value imported from the inner module
object? m/lib-local
m/lib-local/test-needs-file-value = 42 ; value imported from the inner module
]

--test-- "import needs url!"
Expand All @@ -334,9 +334,9 @@ probe all [
--assert true? test-needs-url-result
]

--test-- "local-lib"
--test-- "lib-local"
;@@ https://github.com/Oldes/Rebol-wishes/issues/13
--assert same? local-lib system/contexts/user
--assert same? lib-local system/contexts/user

--test-- "do module from file"
;@@ https://github.com/Oldes/Rebol-issues/issues/1203
Expand All @@ -353,12 +353,12 @@ probe all [
--test-- "issue-1005"
;@@ https://github.com/Oldes/Rebol-issues/issues/1005
m: module [] [a: 1 2]
--assert [local-lib: #[object![]] a: 1] = body-of m
--assert [local-lib a] = keys-of m
--assert [lib-local: #[object![]] a: 1] = body-of m
--assert [lib-local a] = keys-of m
--assert [#[object![]] 1] = values-of m
m: module [exports: [a]] [a: 1 2]
--assert [local-lib: #[object![]] a: 1] = body-of m
--assert [local-lib a] = keys-of m
--assert [lib-local: #[object![]] a: 1] = body-of m
--assert [lib-local a] = keys-of m
--assert [#[object![]] 1] = values-of m

--test-- "issue-1708"
Expand Down

0 comments on commit d352af0

Please sign in to comment.