vocabs: On use-vocab we should throw an error if the vocabulary does not exist.

Also ui.pixel-formats.private does not exist so remove that.

Fixes #2298.
master
Doug Coleman 2020-06-12 18:23:45 -05:00
parent 8bc4a3f2b8
commit 8efe213273
3 changed files with 10 additions and 2 deletions

View File

@ -9,7 +9,7 @@ math.vectors namespaces sequences strings system threads ui ui.backend
ui.backend.gtk.input-methods ui.backend.gtk.io ui.backend.x11.keys
ui.clipboards ui.event-loop ui.gadgets ui.gadgets.private
ui.gadgets.worlds ui.gestures ui.pixel-formats
ui.pixel-formats.private ui.private vocabs.loader ;
ui.private vocabs.loader ;
IN: ui.backend.gtk
SINGLETON: gtk-ui-backend

View File

@ -115,7 +115,7 @@ ERROR: unbalanced-private-declaration vocab ;
vocab-name "Already using ``" "'' vocabulary" surround note.
] [
manifest get
[ [ load-vocab ] dip search-vocabs>> push ]
[ [ ?load-vocab ] dip search-vocabs>> push ]
[ [ vocab-name ] dip search-vocab-names>> adjoin ]
2bi
] if ;

View File

@ -47,6 +47,11 @@ M: vocab lookup-vocab ;
M: object lookup-vocab vocab-name dictionary get at ;
ERROR: no-vocab-named name ;
: ?lookup-vocab ( vocab-spec -- vocab )
dup lookup-vocab [ nip ] [ no-vocab-named ] if* ;
GENERIC: vocab-words-assoc ( vocab-spec -- assoc/f )
M: vocab vocab-words-assoc words>> ;
@ -156,3 +161,6 @@ M: string require
: load-vocab ( name -- vocab )
[ require ] [ lookup-vocab ] bi ;
: ?load-vocab ( name -- vocab )
[ require ] [ ?lookup-vocab ] bi ;