]> gitweb.factorcode.org Git - factor.git/commitdiff
vocabs: On use-vocab we should throw an error if the vocabulary does not exist.
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 12 Jun 2020 23:23:45 +0000 (18:23 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 12 Jun 2020 23:23:45 +0000 (18:23 -0500)
Also ui.pixel-formats.private does not exist so remove that.

Fixes #2298.

basis/ui/backend/gtk/gtk.factor
core/vocabs/parser/parser.factor
core/vocabs/vocabs.factor

index 2c3f49303898bcbc2f92f313c4890167eed6146e..ea6e6687581f51659993d7b0f7a3173377482b82 100644 (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
index a8e7e12a7015385d6333b1def998e9f15fe691ce..9cf97f2fd5eb400827c9c4ba5cfae7e10596b677 100644 (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 ;
index 7db0fb8598486c301e0c91bd683e58ea036484fb..419219b0c63954246e9666d3518d16d6d867994a 100644 (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 ;