Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Cloogle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cloogle
Cloogle
Commits
6ec3dbff
Commit
6ec3dbff
authored
Jan 12, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add instance links on types
parent
4d9088d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
29 deletions
+41
-29
CloogleDBFactory.icl
CloogleDBFactory.icl
+27
-23
DB.icl
DB.icl
+10
-5
Search.icl
Search.icl
+4
-1
No files found.
CloogleDBFactory.icl
View file @
6ec3dbff
...
...
@@ -74,7 +74,7 @@ from CloogleDB import
::
CloogleEntry
(..),
::
ModuleEntry
{
me_loc
,
me_is_core
,
me_is_app
,
me_documentation
},
::
FunctionEntry
{
fe_loc
,
fe_type
,
fe_kind
,
fe_generic_vars
,
fe_priority
,
fe_representation
,
fe_documentation
,
fe_class
},
::
TypeDefEntry
{
tde_loc
},
::
TypeDefEntry
{
tde_loc
,
tde_instances
},
::
ClassEntry
{
ce_loc
,
ce_instances
},
::
SyntaxEntry
,
::
DeriveEntry
,
::
InstanceEntry
{
ie_class
,
ie_types
,
ie_locations
},
...
...
@@ -113,30 +113,27 @@ newTemporaryDb
}
finaliseDb
::
![
CloogleEntry
]
!
TemporaryDB
->
*'
CDB
'.
CloogleDB
finaliseDb
extra
tdb
#
db
=
newDB
entries
#
name_ngrams
=
foldr
(
uncurry
index
)
(
newNGramIndex
3
True
)
[('
CDB
'.
getName
loc
,
i
)
\\
(
i
,
e
)
<-
entridxs
,
Just
loc
<-
['
CDB
'.
getLocation
e
]]
=
{
db
=
db
,
name_ngrams
=
name_ngrams
finaliseDb
extra
tdb
=
{
db
=
newDB
entries
,
name_ngrams
=
foldr
(
uncurry
index
)
(
newNGramIndex
3
True
)
[('
CDB
'.
getName
loc
,
i
)
\\
(
i
,
e
)
<-
entridxs
,
Just
loc
<-
['
CDB
'.
getLocation
e
]]
,
types
=
foldr
(
uncurry
addType
)
zero
[(
snd
$
'T'
.
prepare_unification
False
(
map
'
CDB
'.
getTypeDef
typedefs
)
$
'T'
.
removeTypeContexts
t
,
i
)
[(
snd
$
'T'
.
prepare_unification
False
['
CDB
'.
getTypeDef
td
\\
TypeDefEntry
td
<-
entries
]
$
'T'
.
removeTypeContexts
t
,
i
)
\\
(
i
,
FunctionEntry
fe
)
<-
entridxs
,
Just
t
<-
[
fe
.
fe_type
<|>
(
docType
=<<
fe
.
fe_documentation
)]]
,
core
=
coreidxs
,
apps
=
appidxs
,
builtins
=
builtinidxs
,
builtins
=
idxfilter
\
e
->
fromMaybe
False
('
CDB
'.
isBuiltin
<$>
'
CDB
'.
getLocation
e
)
,
syntax
=
idxfilter
\
e
->
e
=:(
SyntaxEntry
_)
,
library_map
=
libmap
,
module_map
=
modmap
}
where
entries
=
entries
=
map
link
$
extra
++
[
FunctionEntry
fun
\\
funs
<-
tdb
.
temp_functions
,
fun
<-
funs
]
++
map
TypeDefEntry
typedefs
++
[
TypeDefEntry
tde
\\
tds
<-
tdb
.
temp_types
,
tde
<-
tds
]
++
[
ModuleEntry
mod
\\
mod
<-
tdb
.
temp_modules
]
++
map
ClassEntry
classes
++
[
ClassEntry
cls
\\
clss
<-
tdb
.
temp_classes
,
(
cls
,_)
<-
clss
]
++
[
FunctionEntry
{
fun
&
fe_kind
=
case
fun
.
fe_kind
of
Function
->
ClassMember
;
Macro
->
ClassMacro
...
...
@@ -146,20 +143,30 @@ where
_
->
False
}
\\
clss
<-
tdb
.
temp_classes
,
(
cls
,
funs
)
<-
clss
,
(
fname
,
fun
)
<-
funs
]
++
[
InstanceEntry
{
ie_class
=
cls
,
ie_types
=
types
,
ie_locations
=
map
thd3
is
}
// TODO combine locations
[
InstanceEntry
{
ie_class
=
cls
,
ie_types
=
types
,
ie_locations
=
map
thd3
is
}
\\
is
=:[(
cls
,
types
,_):_]
<-
groupBy
instanceEq
$
sortBy
((<)
`
on`
(\(
c
,
ts
,_)
->
(
c
,
map
snd
ts
)))
$
flatten
tdb
.
temp_instances
]
where
link
::
CloogleEntry
->
CloogleEntry
link
(
TypeDefEntry
tde
)
=
TypeDefEntry
{
tde
&
tde_instances
=
idxfilter
\
e
->
case
e
of
InstanceEntry
ie
->
not
$
isEmpty
[()
\\
'T'
.
Type
t
[]
<-
concatMap
(
'T'
.
subtypes
o
fst
)
ie
.
ie_types
|
t
==
'
CDB
'.
getName
tde
.
tde_loc
]
_
->
False
}
link
(
ClassEntry
ce
)
=
ClassEntry
{
ce
&
ce_instances
=
idxfilter
\
e
->
case
e
of
InstanceEntry
ie
->
ie
.
ie_class
==
'
CDB
'.
getName
ce
.
ce_loc
_
->
False
}
link
e
=
e
entridxs
=
zip2
[
Index
i
\\
i
<-
[
0
..]]
entries
idxfilter
f
=
[
idx
\\
(
idx
,
e
)
<-
entridxs
|
f
e
]
idxhd
=
hd
o
idxfilter
typedefs
=
[
td
\\
tds
<-
tdb
.
temp_types
,
td
<-
tds
]
classes
=
[{
cls
&
ce_instances
=
idxfilter
\
e
->
case
e
of
InstanceEntry
ie
->
ie
.
ie_class
==
'
CDB
'.
getName
cls
.
ce_loc
_
->
False
}
\\
clss
<-
tdb
.
temp_classes
,
(
cls
,_)
<-
clss
]
coreidxs
=
idxfilter
\
e
->
case
'
CDB
'.
getLocation
e
of
Nothing
->
False
Just
l
->
case
('
CDB
'.
getLibrary
l
,
'
CDB
'.
getModule
l
)
of
...
...
@@ -174,9 +181,6 @@ where
_
->
False
where
appmods
=
[(
fromJust
$
'
CDB
'.
getLibrary
me
.
me_loc
,
fromJust
$
'
CDB
'.
getModule
me
.
me_loc
)
\\
me
<-
tdb
.
temp_modules
|
me
.
me_is_app
]
builtinidxs
=
idxfilter
\
e
->
case
'
CDB
'.
getLocation
e
of
Just
(
Builtin
_
_)
->
True
_
->
False
libmap
=
'M'
.
fromList
[(
l
,
idxfilter
\
e
->
case
'
CDB
'.
getLocation
e
>>=
'
CDB
'.
getLibrary
of
...
...
DB.icl
View file @
6ec3dbff
...
...
@@ -180,8 +180,13 @@ getIndex (Index n) (DB db)
=
(
e
,
DB
db
)
getIndices
::
![
Index
]
!*(
DB
v
ak
a
)
->
*(![
Entry
v
ak
a
],
!*(
DB
v
ak
a
))
getIndices
[]
db
=
([],
db
)
getIndices
[
i
:
is
]
db
#
(
e
,
db
)
=
getIndex
i
db
#
(
es
,
db
)
=
getIndices
is
db
=
([
e
:
es
],
db
)
getIndices
is
(
DB
db
)
#
(
es
,
db
)
=
get
is
db
=
(
es
,
DB
db
)
where
get
::
![
Index
]
!*{!
Entry
v
ak
a
}
->
*(![
Entry
v
ak
a
],
!*{!
Entry
v
ak
a
})
get
[]
db
=
([],
db
)
get
[
Index
i
:
is
]
db
#
(
e
,
db
)
=
db
![
i
]
#
(
es
,
db
)
=
get
is
db
=
([
e
:
es
],
db
)
Search.icl
View file @
6ec3dbff
...
...
@@ -124,9 +124,12 @@ makeResult orgsearchtype tdes usedsyns (entry, annots) db
contextPenalty
required_context
=
length
[
0
\\
(_,[])
<-
required_context
]
|
entry
=:
(
TypeDefEntry
_)
#
(
TypeDefEntry
tde
)
=
entry
#
(
insts
,
db
)
=
getIndices
tde
.
tde_instances
db
=
(
TypeResult
(
general
,
{
type
=
concat
$
print
False
tde
.
tde_typedef
,
type_instances
=
[]
// TODO
,
type_instances
=
sortBy
((<)
`
on`
fst3
)
[(
ie
.
ie_class
,
map
snd
ie
.
ie_types
,
map
locResult
ie
.
ie_locations
)
\\
{
value
=
InstanceEntry
ie
}
<-
insts
]
,
type_derivations
=
[]
// TODO
,
type_field_doc
=
docFields
=<<
tde
.
tde_doc
,
type_constructor_doc
=
map
((=<<)
docDescription
)
<$>
(
docConstructors
=<<
tde
.
tde_doc
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment