Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
e3815430
Commit
e3815430
authored
Jun 22, 2013
by
ian@well-typed.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whitespace only in HeaderInfo
parent
569b2652
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
34 deletions
+27
-34
compiler/main/HeaderInfo.hs
compiler/main/HeaderInfo.hs
+27
-34
No files found.
compiler/main/HeaderInfo.hs
View file @
e3815430
...
...
@@ -8,13 +8,6 @@
--
-----------------------------------------------------------------------------
{-# OPTIONS -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details
module
HeaderInfo
(
getImports
,
mkPrelImports
-- used by the renamer too
,
getOptionsFromFile
,
getOptions
...
...
@@ -25,7 +18,7 @@ module HeaderInfo ( getImports
import
RdrName
import
HscTypes
import
Parser
(
parseHeader
)
import
Parser
(
parseHeader
)
import
Lexer
import
FastString
import
HsSyn
...
...
@@ -39,7 +32,7 @@ import Util
import
Outputable
import
Pretty
()
import
Maybes
import
Bag
(
emptyBag
,
listToBag
,
unitBag
)
import
Bag
(
emptyBag
,
listToBag
,
unitBag
)
import
MonadUtils
import
Exception
...
...
@@ -74,23 +67,23 @@ getImports dflags buf filename source_filename = do
if
errorsFound
dflags
ms
then
throwIO
$
mkSrcErr
errs
else
case
rdr_module
of
L
_
(
HsModule
mb_mod
_
imps
_
_
_
)
->
let
case
rdr_module
of
L
_
(
HsModule
mb_mod
_
imps
_
_
_
)
->
let
main_loc
=
srcLocSpan
(
mkSrcLoc
(
mkFastString
source_filename
)
1
1
)
mod
=
mb_mod
`
orElse
`
L
main_loc
mAIN_NAME
(
src_idecls
,
ord_idecls
)
=
partition
(
ideclSource
.
unLoc
)
imps
mod
=
mb_mod
`
orElse
`
L
main_loc
mAIN_NAME
(
src_idecls
,
ord_idecls
)
=
partition
(
ideclSource
.
unLoc
)
imps
-- GHC.Prim doesn't exist physically, so don't go looking for it.
ordinary_imps
=
filter
((
/=
moduleName
gHC_PRIM
)
.
unLoc
.
ideclName
.
unLoc
)
ord_idecls
-- GHC.Prim doesn't exist physically, so don't go looking for it.
ordinary_imps
=
filter
((
/=
moduleName
gHC_PRIM
)
.
unLoc
.
ideclName
.
unLoc
)
ord_idecls
implicit_prelude
=
xopt
Opt_ImplicitPrelude
dflags
implicit_imports
=
mkPrelImports
(
unLoc
mod
)
main_loc
implicit_prelude
imps
in
return
(
src_idecls
,
implicit_imports
++
ordinary_imps
,
mod
)
in
return
(
src_idecls
,
implicit_imports
++
ordinary_imps
,
mod
)
mkPrelImports
::
ModuleName
mkPrelImports
::
ModuleName
->
SrcSpan
-- Attribute the "import Prelude" to this location
->
Bool
->
[
LImportDecl
RdrName
]
->
[
LImportDecl
RdrName
]
...
...
@@ -108,20 +101,20 @@ mkPrelImports this_mod loc implicit_prelude import_decls
where
explicit_prelude_import
=
notNull
[
()
|
L
_
(
ImportDecl
{
ideclName
=
mod
,
ideclPkgQual
=
Nothing
})
,
ideclPkgQual
=
Nothing
})
<-
import_decls
,
unLoc
mod
==
pRELUDE_NAME
]
,
unLoc
mod
==
pRELUDE_NAME
]
preludeImportDecl
::
LImportDecl
RdrName
preludeImportDecl
=
L
loc
$
ImportDecl
{
ideclName
=
L
loc
pRELUDE_NAME
,
ideclPkgQual
=
Nothing
,
ideclSource
=
False
,
ideclSafe
=
False
,
-- Not a safe import
ideclQualified
=
False
,
ideclImplicit
=
True
,
-- Implicit!
ideclAs
=
Nothing
,
ideclHiding
=
Nothing
}
ideclPkgQual
=
Nothing
,
ideclSource
=
False
,
ideclSafe
=
False
,
-- Not a safe import
ideclQualified
=
False
,
ideclImplicit
=
True
,
-- Implicit!
ideclAs
=
Nothing
,
ideclHiding
=
Nothing
}
parseError
::
DynFlags
->
SrcSpan
->
MsgDoc
->
IO
a
parseError
dflags
span
err
=
throwOneError
$
mkPlainErrMsg
dflags
span
err
...
...
@@ -138,7 +131,7 @@ getOptionsFromFile :: DynFlags
->
IO
[
Located
String
]
-- ^ Parsed options, if any.
getOptionsFromFile
dflags
filename
=
Exception
.
bracket
(
openBinaryFile
filename
ReadMode
)
(
openBinaryFile
filename
ReadMode
)
(
hClose
)
(
\
handle
->
do
opts
<-
fmap
(
getOptions'
dflags
)
...
...
@@ -226,7 +219,7 @@ getOptions' :: DynFlags
->
[
Located
String
]
-- Options.
getOptions'
dflags
toks
=
parseToks
toks
where
where
getToken
(
L
_loc
tok
)
=
tok
getLoc
(
L
loc
_tok
)
=
loc
...
...
@@ -313,9 +306,9 @@ unsupportedExtnError dflags loc unsup =
optionsErrorMsgs
::
DynFlags
->
[
String
]
->
[
Located
String
]
->
FilePath
->
Messages
optionsErrorMsgs
dflags
unhandled_flags
flags_lines
_filename
=
(
emptyBag
,
listToBag
(
map
mkMsg
unhandled_flags_lines
))
where
unhandled_flags_lines
=
[
L
l
f
|
f
<-
unhandled_flags
,
L
l
f'
<-
flags_lines
,
f
==
f'
]
mkMsg
(
L
flagSpan
flag
)
=
where
unhandled_flags_lines
=
[
L
l
f
|
f
<-
unhandled_flags
,
L
l
f'
<-
flags_lines
,
f
==
f'
]
mkMsg
(
L
flagSpan
flag
)
=
ErrUtils
.
mkPlainErrMsg
dflags
flagSpan
$
text
"unknown flag in {-# OPTIONS_GHC #-} pragma:"
<+>
text
flag
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