Skip to content

Commit 238a8c2

Browse files
committed
FIX: red/system support is back
1 parent 561584f commit 238a8c2

File tree

1 file changed

+35
-44
lines changed

1 file changed

+35
-44
lines changed

semantic.red

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ semantic: context [
271271
]
272272

273273
add-include-file: function [top [block!] depth [integer!]][
274+
unless top [exit]
274275
if depth <= 0 [exit]
275276
include-file: function [file [file!]][
276277
if all [
@@ -352,7 +353,7 @@ semantic: context [
352353
]
353354
write-log rejoin ["parse uri: " uri]
354355
top: lexer/transcode code
355-
repend top ['uri uri 'ftype ftype]
356+
repend top/1 ['uri uri 'ftype ftype]
356357
add-source-to-table uri top
357358
top
358359
]
@@ -1654,20 +1655,18 @@ completion: context [
16541655
]
16551656
]
16561657

1657-
collect-word: function [top [block!] pc [block!] system? [logic!]][
1658+
collect-word: function [top [block!] pc [block!]][
16581659
result: make block! 4
16591660
word: to word! pc/1/expr/1
16601661
collect-word* pc word result no
16611662
sources: semantic/sources
16621663
forall sources [
1663-
if sources/1 <> top [
1664-
nsystem?: no
1665-
if all [
1666-
nsystem? = system?
1667-
nested: sources/1/1/nested
1668-
][
1669-
collect-word* back tail nested word result no
1670-
]
1664+
if all [
1665+
sources/1 <> top
1666+
sources/1/1/ftype = top/1/ftype
1667+
nested: sources/1/1/nested
1668+
][
1669+
collect-word* back tail nested word result no
16711670
]
16721671
]
16731672
result
@@ -2060,7 +2059,7 @@ completion: context [
20602059
]
20612060

20622061
complete-word: function [top [block!] pc [block!] comps [block!]][
2063-
system?: no
2062+
system?: top/1/ftype = 'reds
20642063
system-completion-kind: function [word [word!]][
20652064
type: type?/word get word
20662065
kind: case [
@@ -2119,7 +2118,7 @@ completion: context [
21192118
if empty? string: to string! to word! pc/1/expr/1 [
21202119
exit
21212120
]
2122-
result: collect-word top pc system?
2121+
result: collect-word top pc
21232122
forall result [
21242123
rpc: result/1
21252124
top: rpc
@@ -2599,7 +2598,7 @@ completion: context [
25992598
specs
26002599
]
26012600

2602-
collect-path: function [top [block!] pc [block!] path [block!] *all? [logic!] match? [logic!] system? [logic!]][
2601+
collect-path: function [top [block!] pc [block!] path [block!] *all? [logic!] match? [logic!]][
26032602
specs: make block! 8
26042603
ret: collect-path* pc path *all? match?
26052604
if 0 < length? ret [
@@ -2608,25 +2607,22 @@ completion: context [
26082607
]
26092608
sources: semantic/sources
26102609
forall sources [
2611-
if sources/1 <> top [
2612-
nsystem?: no
2613-
if all [
2614-
nsystem? = system?
2615-
nested: sources/1/1/nested
2616-
][
2617-
ret: collect-path* back tail nested path *all? match?
2618-
if 0 < length? ret [
2619-
append specs ret
2620-
unless *all? [return specs]
2621-
]
2610+
if all [
2611+
sources/1 <> top
2612+
sources/1/1/ftype = top/1/ftype
2613+
nested: sources/1/1/nested
2614+
][
2615+
ret: collect-path* back tail nested path *all? match?
2616+
if 0 < length? ret [
2617+
append specs ret
2618+
unless *all? [return specs]
26222619
]
26232620
]
26242621
]
26252622
specs
26262623
]
26272624

26282625
complete-path: function [top [block!] pc [block!] comps [block!]][
2629-
system?: no
26302626
complete-sys-path: function [][
26312627
unless system-words/keyword? no fword [exit]
26322628
pure-path: to string! to path! path
@@ -2682,7 +2678,7 @@ completion: context [
26822678
fword: to word! paths/1
26832679
filter: to string! last paths
26842680

2685-
pcs: collect-path top pc paths no no system?
2681+
pcs: collect-path top pc paths no no
26862682
forall pcs [
26872683
type: pcs/1/1
26882684
npc: pcs/1/2
@@ -2866,7 +2862,7 @@ completion: context [
28662862
]
28672863

28682864
resolve-word: function [top [block!] pc [block!] string [string!] itype [word! none!]][
2869-
system?: no
2865+
system?: top/1/ftype = 'reds
28702866
resolve-word*: function [][
28712867
if all [
28722868
set-word! = pc/1/type
@@ -3073,7 +3069,6 @@ completion: context [
30733069
]
30743070

30753071
hover-word*: function [top [block!] pc [block!] word [word!] *all? [logic!]][
3076-
system?: no
30773072
result: make block! 4
30783073
collect-word*/match? pc word result *all?
30793074
if all [
@@ -3082,19 +3077,17 @@ completion: context [
30823077
][return result]
30833078
sources: semantic/sources
30843079
forall sources [
3085-
if sources/1 <> top [
3086-
nsystem?: no
3080+
if all [
3081+
sources/1 <> top
3082+
sources/1/1/ftype = top/1/ftype
3083+
nested: sources/1/1/nested
3084+
][
3085+
npc: back tail nested
3086+
collect-word*/match? npc word result *all?
30873087
if all [
3088-
nsystem? = system?
3089-
nested: sources/1/1/nested
3090-
][
3091-
npc: back tail nested
3092-
collect-word*/match? npc word result *all?
3093-
if all [
3094-
not *all?
3095-
0 < length? result
3096-
][return result]
3097-
]
3088+
not *all?
3089+
0 < length? result
3090+
][return result]
30983091
]
30993092
]
31003093
result
@@ -3116,8 +3109,7 @@ completion: context [
31163109
]
31173110

31183111
hover-path: function [top [block!] pc [block!] path [block!]][
3119-
system?: no
3120-
result: collect-path top pc path no yes system?
3112+
result: collect-path top pc path no yes
31213113
if 0 = length? result [return none]
31223114
pc: result/1/2
31233115
top: get-top pc
@@ -3210,8 +3202,7 @@ completion: context [
32103202
]
32113203

32123204
definition-path: function [top [block!] pc [block!] path [block!]][
3213-
system?: no
3214-
result: collect-path top pc path yes yes system?
3205+
result: collect-path top pc path yes yes
32153206
if 0 = length? result [return none]
32163207
ret: make block! 4
32173208
forall result [

0 commit comments

Comments
 (0)