Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
haddock
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rinat Striungis
haddock
Commits
63c7e87d
Commit
63c7e87d
authored
5 years ago
by
Zubin
Committed by
Alec Theriault
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix crash when there are no srcspans in the file due to CPP
parent
9bbcd385
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
haddock-api/src/Haddock.hs
+1
-1
1 addition, 1 deletion
haddock-api/src/Haddock.hs
haddock-api/src/Haddock/Backends/Hyperlinker.hs
+11
-8
11 additions, 8 deletions
haddock-api/src/Haddock/Backends/Hyperlinker.hs
with
12 additions
and
9 deletions
haddock-api/src/Haddock.hs
+
1
−
1
View file @
63c7e87d
...
...
@@ -432,7 +432,7 @@ render dflags flags sinceQual qual ifaces installedIfaces extSrcMap = do
when
(
Flag_HyperlinkedSource
`
elem
`
flags
&&
not
(
null
ifaces
))
$
do
withTiming
(
pure
dflags'
)
"ppHyperlinkedSource"
(
const
()
)
$
do
_
<-
{-# SCC ppHyperlinkedSource #-}
ppHyperlinkedSource
odir
libDir
opt_source_css
pretty
srcMap
ifaces
ppHyperlinkedSource
(
verbosity
flags
)
odir
libDir
opt_source_css
pretty
srcMap
ifaces
return
()
...
...
This diff is collapsed.
Click to expand it.
haddock-api/src/Haddock/Backends/Hyperlinker.hs
+
11
−
8
View file @
63c7e87d
...
...
@@ -7,7 +7,7 @@ module Haddock.Backends.Hyperlinker
import
Haddock.Types
import
Haddock.Utils
(
writeUtf8File
)
import
Haddock.Utils
(
writeUtf8File
,
out
,
verbose
,
Verbosity
)
import
Haddock.Backends.Hyperlinker.Renderer
import
Haddock.Backends.Hyperlinker.Parser
import
Haddock.Backends.Hyperlinker.Types
...
...
@@ -32,27 +32,28 @@ import UniqSupply ( mkSplitUniqSupply )
-- Note that list of interfaces should also contain interfaces normally hidden
-- when generating documentation. Otherwise this could lead to dead links in
-- produced source.
ppHyperlinkedSource
::
FilePath
-- ^ Output directory
ppHyperlinkedSource
::
Verbosity
->
FilePath
-- ^ Output directory
->
FilePath
-- ^ Resource directory
->
Maybe
FilePath
-- ^ Custom CSS file path
->
Bool
-- ^ Flag indicating whether to pretty-print HTML
->
M
.
Map
Module
SrcPath
-- ^ Paths to sources
->
[
Interface
]
-- ^ Interfaces for which we create source
->
IO
()
ppHyperlinkedSource
outdir
libdir
mstyle
pretty
srcs'
ifaces
=
do
ppHyperlinkedSource
verbosity
outdir
libdir
mstyle
pretty
srcs'
ifaces
=
do
createDirectoryIfMissing
True
srcdir
let
cssFile
=
fromMaybe
(
defaultCssFile
libdir
)
mstyle
copyFile
cssFile
$
srcdir
</>
srcCssFile
copyFile
(
libdir
</>
"html"
</>
highlightScript
)
$
srcdir
</>
highlightScript
mapM_
(
ppHyperlinkedModuleSource
srcdir
pretty
srcs
)
ifaces
mapM_
(
ppHyperlinkedModuleSource
verbosity
srcdir
pretty
srcs
)
ifaces
where
srcdir
=
outdir
</>
hypSrcDir
srcs
=
(
srcs'
,
M
.
mapKeys
moduleName
srcs'
)
-- | Generate hyperlinked source for particular interface.
ppHyperlinkedModuleSource
::
FilePath
->
Bool
->
SrcMaps
->
Interface
->
IO
()
ppHyperlinkedModuleSource
srcdir
pretty
srcs
iface
=
case
ifaceHieFile
iface
of
ppHyperlinkedModuleSource
::
Verbosity
->
FilePath
->
Bool
->
SrcMaps
->
Interface
->
IO
()
ppHyperlinkedModuleSource
verbosity
srcdir
pretty
srcs
iface
=
case
ifaceHieFile
iface
of
Just
hfp
->
do
-- Parse the GHC-produced HIE file
u
<-
mkSplitUniqSupply
'a'
...
...
@@ -75,8 +76,10 @@ ppHyperlinkedModuleSource srcdir pretty srcs iface = case ifaceHieFile iface of
in
writeUtf8File
path
.
renderToString
pretty
.
render'
fullAst
$
tokens
Nothing
|
M
.
size
asts
==
0
->
return
()
|
otherwise
->
error
$
unwords
[
"couldn't find ast for"
,
file
,
show
(
M
.
keys
asts
)
]
|
otherwise
->
do
out
verbosity
verbose
$
unwords
[
"couldn't find ast for"
,
file
,
show
(
M
.
keys
asts
)
]
return
()
Nothing
->
return
()
where
df
=
ifaceDynFlags
iface
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment