@@ -28,13 +28,11 @@ import Language.PureScript.AST.Traversals (everywhereOnValuesM)
2828import Protolude (identity )
2929import Language.PureScript.Names qualified as T
3030
31- sqliteExtern :: (MonadIO m ) => FilePath -> Module -> Docs. Module -> ExternsFile -> m ()
32- sqliteExtern outputDir m docs extern = liftIO $ do
31+ sqliteExtern :: (MonadIO m ) => FilePath -> Module -> ExternsFile -> m ()
32+ sqliteExtern outputDir m extern = liftIO $ do
3333 conn <- SQLite. open db
3434 SQLite. execute_ conn " pragma busy_timeout = 300000;"
3535
36- -- Debug.traceM $ show extern
37-
3836 let (doDecl, _, _) = everywhereOnValuesM (pure . identity) (\ expr -> case expr of
3937 Var ss i -> do
4038 let iv = disqualify i
@@ -62,7 +60,7 @@ sqliteExtern outputDir m docs extern = liftIO $ do
6260 SQLite. executeNamed conn
6361 " insert into modules (module_name, comment, extern, dec) values (:module_name, :docs, :extern, :dec)"
6462 [ " :module_name" := runModuleName ( efModuleName extern )
65- , " :docs" := Docs. modComments docs
63+ , " :docs" := Just ( " " :: Text )
6664 , " :extern" := Serialise. serialise extern
6765 , " :dec" := show ( efExports extern )
6866 ]
@@ -110,52 +108,6 @@ sqliteExtern outputDir m docs extern = liftIO $ do
110108 , " :declaration" := serialise ideDeclaration
111109 ])
112110
113- for_ (Docs. modDeclarations docs) (\ d -> do
114- SQLite. executeNamed conn
115- (" insert into declarations (module_name, name, namespace, declaration_type, span, type, docs, declaration) " <>
116- " values (:module_name, :name, :namespace, :declaration_type, :span, :type, :docs, :declaration)"
117- )
118- [ " :module_name" := runModuleName (efModuleName extern)
119- , " :name" := Docs. declTitle d
120- , " :namespace" := toIdeNamespace d
121- , " :declaration_type" := toDeclarationType d
122- , " :span" := Aeson. encode (Docs. declSourceSpan d)
123- , " :docs" := Docs. declComments d
124- , " :type" := runDocs (declAsMarkdown d)
125- , " :declaration" := show d
126- ]
127-
128-
129- for_ (declChildren d) $ \ ch -> do
130- SQLite. executeNamed conn
131- (" insert into declarations (module_name, name, namespace, span, docs, declaration) " <>
132- " values (:module_name, :name, :namespace, :span, :docs, :declaration)" )
133- [ " :module_name" := runModuleName (efModuleName extern)
134- , " :name" := Docs. cdeclTitle ch
135- , " :namespace" := childDeclInfoNamespaceIde (Docs. cdeclInfo ch)
136- , " :span" := Aeson. encode (Docs. declSourceSpan d)
137- , " :docs" := Docs. cdeclComments ch
138- , " :declaration" := show d
139- ]
140- )
141-
142-
143- for_ (Docs. modReExports docs) $ \ rexport -> do
144- for_ (snd rexport) $ \ d -> do
145- SQLite. executeNamed conn
146- (" insert into declarations (module_name, name, rexported_from, declaration_type, span, type, docs, declaration)" <>
147- " values (:module_name, :name, :rexported_from, :declaration_type, :span, :type, :docs, :declaration)"
148- )
149- [ " :module_name" := runModuleName (efModuleName extern)
150- , " :name" := Docs. declTitle d
151- , " :rexported_from" := (" HOLAS" :: Text ) -- runModuleName (Docs.ignorePackage (fst rexport))
152- , " :declaration_type" := toDeclarationType d
153- , " :span" := Aeson. encode (Docs. declSourceSpan d)
154- , " :docs" := Docs. declComments d
155- , " :type" := runDocs (declAsMarkdown d)
156- , " :declaration" := show d
157- ]
158-
159111 SQLite. close conn
160112 return ()
161113 where
@@ -201,20 +153,6 @@ sqliteInit outputDir = liftIO $ do
201153 , " )"
202154 ]
203155
204- SQLite. execute_ conn $ SQLite. Query $ Text. pack $ unlines
205- [ " create table if not exists declarations ("
206- , " module_name text references modules(module_name) on delete cascade,"
207- , " name text not null,"
208- , " namespace text,"
209- , " declaration_type text,"
210- , " rexported_from text,"
211- , " type text,"
212- , " docs text,"
213- , " span text,"
214- , " declaration text not null"
215- , " )"
216- ]
217-
218156 SQLite. execute_ conn $ SQLite. Query $ Text. pack $ unlines
219157 [ " create table if not exists asts ("
220158 , " module_name text references modules(module_name) on delete cascade,"
@@ -232,13 +170,9 @@ sqliteInit outputDir = liftIO $ do
232170 , " )"
233171 ]
234172
235- SQLite. execute_ conn " create index if not exists dm on declarations(module_name)"
236- SQLite. execute_ conn " create index if not exists dn on declarations(name);"
237-
238173 SQLite. execute_ conn " create index if not exists asts_module_name_idx on asts(module_name);"
239174 SQLite. execute_ conn " create index if not exists asts_name_idx on asts(name);"
240175
241-
242176 SQLite. execute_ conn " create index if not exists exports_name_idx on exports(name);"
243177 SQLite. execute_ conn " create index if not exists exports_module_name_idx on exports(module_name);"
244178
0 commit comments