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
0bce9bfe
Commit
0bce9bfe
authored
Jan 12, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More efficient synonym resolution
parent
d481ef7c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
13 deletions
+27
-13
CleanTypeUnifier
CleanTypeUnifier
+1
-1
CloogleDB.dcl
CloogleDB.dcl
+1
-1
CloogleDB.icl
CloogleDB.icl
+9
-3
CloogleDBFactory.icl
CloogleDBFactory.icl
+9
-1
Search.icl
Search.icl
+7
-7
No files found.
CleanTypeUnifier
@
4f5fc287
Compare
88f9081b
...
4f5fc287
Subproject commit
88f9081be752059680def72dee18646f0a58af7f
Subproject commit
4f5fc287b3a72e1ab13305340d1a1d676d141f92
CloogleDB.dcl
View file @
0bce9bfe
...
...
@@ -256,7 +256,7 @@ filterModules :: ![Name] !*CloogleDB -> *CloogleDB
filterName
::
!
String
!*
CloogleDB
->
*
CloogleDB
filterUnifying
::
!
Type
!*
CloogleDB
->
*
CloogleDB
allType
Defs
::
!*
CloogleDB
->
*([
TypeDefEntry
],
*
CloogleDB
)
allType
Synonyms
::
!*
CloogleDB
->
*(
Map
Name
[
TypeDef
],
*
CloogleDB
)
getInstances
::
!
Name
!*
CloogleDB
->
*([
InstanceEntry
],
*
CloogleDB
)
getDerivations
::
!
Name
!*
CloogleDB
->
*([
DeriveEntry
],
*
CloogleDB
)
...
...
CloogleDB.icl
View file @
0bce9bfe
...
...
@@ -433,10 +433,16 @@ where
typeComplexity
(
Arrow
(
Just
t
))
=
5.0
+
typeComplexity
t
typeComplexity
(
Arrow
Nothing
)
=
5.0
allType
Defs
::
!*
CloogleDB
->
*([
TypeDefEntry
],
*
CloogleDB
)
allType
Def
s
wrap
=:{
db
}
allType
Synonyms
::
!*
CloogleDB
->
*(
Map
Name
[
TypeDef
],
*
CloogleDB
)
allType
Synonym
s
wrap
=:{
db
}
#
(
es
,
db
)
=
'
DB
'.
allEntries
db
=
([
tde
\\
TypeDefEntry
tde
<-
es
],
{
wrap
&
db
=
db
})
=
(
fromList
$
map
(\
syns
=:[(
t
,_):_]
->
(
t
,
map
snd
syns
))
$
groupBy
((==)
`
on`
fst
)
$
sortBy
((<)
`
on`
fst
)
[(
td
.
td_name
,
td
)
\\
TypeDefEntry
{
tde_typedef
=
td
=:{
td_rhs
=
TDRSynonym
t
}}
<-
es
]
,
{
wrap
&
db
=
db
}
)
getInstances
::
!
Name
!*
CloogleDB
->
*([
InstanceEntry
],
*
CloogleDB
)
getInstances
c
wrap
=:{
db
,
instance_map
}
...
...
CloogleDBFactory.icl
View file @
0bce9bfe
...
...
@@ -122,7 +122,7 @@ finaliseDb extra tdb =
,
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
['
CDB
'.
getTypeDef
td
\\
TypeDefEntry
td
<-
entries
]
$
'T'
.
removeTypeContexts
t
,
i
)
[(
snd
$
'T'
.
prepare_unification
False
synonymmap
$
'T'
.
removeTypeContexts
t
,
i
)
\\
(
i
,
FunctionEntry
fe
)
<-
entridxs
,
Just
t
<-
[
fe
.
fe_type
<|>
(
docType
=<<
fe
.
fe_documentation
)]]
,
core
=
coreidxs
,
apps
=
appidxs
...
...
@@ -261,6 +261,14 @@ where
Just
m`
->
m
==
m`
)
\\
m
<-
mods
]
where
mods
=
removeDup
[
fromJust
('
CDB
'.
getModule
me
.
me_loc
)
\\
me
<-
tdb
.
temp_modules
]
synonymmap
=
'M'
.
fromList
$
map
(\
syns
=:[(
t
,_):_]
->
(
t
,
map
snd
syns
))
$
groupBy
((==)
`
on`
fst
)
$
sortBy
((<)
`
on`
fst
)
[
let
td
=
'
CDB
'.
getTypeDef
tde
in
(
'T'
.
td_name
td
,
td
)
\\
TypeDefEntry
tde
<-
entries
|
(
'T'
.
td_rhs
('
CDB
'.
getTypeDef
tde
))=:(
'T'
.
TDRSynonym
_)]
// Exclude Root Library Aux Base module
findModules
::
![
String
]
!
String
!'
CDB
'.
Library
!
a
!
String
!*
World
->
*(![('
CDB
'.
Library
,
'
CDB
'.
Module
,
a
)],
!*
World
)
...
...
Search.icl
View file @
0bce9bfe
...
...
@@ -49,21 +49,21 @@ search {unify,name,className,typeName,modules,libraries,page,include_builtins,in
#
cdb
=
case
name
<|>
typeName
<|>
className
of
Nothing
->
cdb
Just
name
->
filterName
name
cdb
#
(
typedefs
,
cdb
)
=
appFst
(
map
getTypeDef
)
$
allTypeDef
s
cdb
#
mbPreppedType
=
prepare_unification
True
typedef
s
<$>
(
unify
>>=
parseType
o
fromString
)
#
(
allsyns
,
cdb
)
=
allTypeSynonym
s
cdb
#
mbPreppedType
=
prepare_unification
True
allsyn
s
<$>
(
unify
>>=
parseType
o
fromString
)
#
usedSynonyms
=
'
Foldable
'.
concat
(
fst
<$>
mbPreppedType
)
#
mbType
=
snd
<$>
mbPreppedType
#
cdb
=
case
mbType
of
Nothing
->
cdb
Just
t
->
filterUnifying
t
cdb
#
(
es
,
cdb
)
=
getEntries
cdb
#
(
es
,
cdb
)
=
mapSt
(
makeResult
mbType
typedef
s
usedSynonyms
)
es
cdb
#
(
es
,
cdb
)
=
mapSt
(
makeResult
mbType
allsyn
s
usedSynonyms
)
es
cdb
=
(
sort
es
,
cdb
)
makeResult
::
(
Maybe
Type
)
[
TypeDef
]
[
TypeDef
]
makeResult
::
(
Maybe
Type
)
(
Map
String
[
TypeDef
])
[
TypeDef
]
(
CloogleEntry
,
Map
AnnotationKey
Annotation
)
*
CloogleDB
->
*(
Result
,
*
CloogleDB
)
makeResult
orgsearchtype
tde
s
usedsyns
(
entry
,
annots
)
db
makeResult
orgsearchtype
allsyn
s
usedsyns
(
entry
,
annots
)
db
|
entry
=:
(
FunctionEntry
_)
#
(
FunctionEntry
fe
)
=
entry
// Parent class
...
...
@@ -72,7 +72,7 @@ makeResult orgsearchtype tdes usedsyns (entry, annots) db
Just
i
->
case
getIndex
i
db
of
({
value
=
ClassEntry
ce
},
db
)
->
(
Just
{
cls_name
=
getName
ce
.
ce_loc
,
cls_vars
=
ce
.
ce_vars
},
db
)
// Unifier
#
unif
=
prepare_unification
False
tde
s
<$>
fe
.
fe_type
>>=
\(
syns
,
type
)
->
#
unif
=
prepare_unification
False
allsyn
s
<$>
fe
.
fe_type
>>=
\(
syns
,
type
)
->
finish_unification
(
syns
++
usedsyns
)
<$>
(
orgsearchtype
>>=
unify
type
)
// Required Context
...
...
@@ -159,7 +159,7 @@ makeResult orgsearchtype tdes usedsyns (entry, annots) db
uni
=
fmap
norm
o
assignAll
(
map
fromUnifyingAssignment
unif
.
assignments
)
norm
::
(
Type
->
Type
)
norm
=
snd
o
resolve_synonyms
tde
s
norm
=
snd
o
resolve_synonyms
allsyn
s
findLocations
::
TypeRestriction
*
CloogleDB
->
*([
Location
],
*
CloogleDB
)
findLocations
(
Instance
c
ts
)
db
...
...
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