Verified Commit 0a8ac007 authored by Camil Staps's avatar Camil Staps 🚀

Update Cloogle core

parent f775c7f5
Subproject commit 84f36d1d1f43ab94233cb631a07c1407e4c13922
Subproject commit a06d99e0964bb6d20022140780dec7999fd0626c
......@@ -89,7 +89,7 @@ where
= snd $ fclose io w
handle :: !TypeDB !(Maybe Request) !*World -> *(!Response, CacheKey, !*World)
handle _ Nothing w = (err CLOOGLE_E_INVALIDINPUT "Couldn't parse input", "", w)
handle _ Nothing w = (err InvalidInput "Couldn't parse input", "", w)
handle db (Just request=:{unify,name,page}) w
//Check cache
# (mbResponse, w) = readCache key w
......@@ -97,11 +97,11 @@ where
# r = fromJust mbResponse
= ({r & return = if (r.return == 0) 1 r.return}, cacheKey key, w)
| isJust name && size (fromJust name) > 40
= respond (err CLOOGLE_E_INVALIDNAME "Function name too long") w
= respond (err InvalidName "Function name too long") w
| isJust name && any isSpace (fromString $ fromJust name)
= respond (err CLOOGLE_E_INVALIDNAME "Name cannot contain spaces") w
= respond (err InvalidName "Name cannot contain spaces") w
| isJust unify && isNothing (parseType $ fromString $ fromJust unify)
= respond (err CLOOGLE_E_INVALIDTYPE "Couldn't parse type") w
= respond (err InvalidType "Couldn't parse type") w
// Results
# drop_n = fromJust (page <|> pure 0) * MAX_RESULTS
# results = drop drop_n $ sort $ search request db
......@@ -121,7 +121,7 @@ where
# (results,nextpages) = splitAt MAX_RESULTS results
// Response
# response = if (isEmpty results)
(err CLOOGLE_E_NORESULTS "No results")
(err NoResults "No results")
{ zero
& data = results
, more_available = Just more
......@@ -529,3 +529,11 @@ where
, response_code = response.return
, results = length response.data
}
err :: CloogleError String -> Response
err c m = { return = toInt c
, data = []
, msg = m
, more_available = Nothing
, suggestions = Nothing
}
......@@ -8,6 +8,7 @@ CLMFLAGS:=-dynamics -h 200M -nr -nt\
-I $$CLEAN_HOME/lib/Generics\
-I $$CLEAN_HOME/lib/TCPIP\
-I Cloogle\
-I Cloogle/libcloogle\
-I Cloogle/clean-platform/src/libraries/OS-Independent\
-I Cloogle/clean-platform/src/libraries/OS-Independent/Deprecated/StdLib\
-I Cloogle/clean-platform/src/libraries/OS-Linux-64\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment