|
3 | 3 | -- |
|
4 | 4 | -- Common data structures and functions supporting analysis of the AST.
|
5 | 5 | module Language.Fortran.Analysis
|
6 |
| - ( initAnalysis, stripAnalysis, Analysis(..), varName, srcName, genVar, puName, blockRhsExprs, rhsExprs |
| 6 | + ( initAnalysis, stripAnalysis, Analysis(..), varName, srcName, genVar, puName, puSrcName, blockRhsExprs, rhsExprs |
7 | 7 | , ModEnv, NameType(..), IDType(..), ConstructType(..), BaseType(..)
|
8 | 8 | , lhsExprs, isLExpr, allVars, allLhsVars, blockVarUses, blockVarDefs
|
9 | 9 | , BB, BBGr
|
@@ -92,12 +92,18 @@ srcName _ = error "Use of srcName on non-variable."
|
92 | 92 | genVar :: Analysis a -> SrcSpan -> String -> Expression (Analysis a)
|
93 | 93 | genVar a s n = ExpValue (a { uniqueName = Just n }) s (ValVariable n)
|
94 | 94 |
|
95 |
| --- | Obtain either uniqueName or source program unit name. |
| 95 | +-- | Obtain either ProgramUnit uniqueName or whatever is in the AST. |
96 | 96 | puName :: ProgramUnit (Analysis a) -> ProgramUnitName
|
97 | 97 | puName pu
|
98 | 98 | | Just n <- uniqueName (getAnnotation pu) = Named n
|
99 | 99 | | otherwise = getName pu
|
100 | 100 |
|
| 101 | +-- | Obtain either ProgramUnit sourceName or whatever is in the AST. |
| 102 | +puSrcName :: ProgramUnit (Analysis a) -> ProgramUnitName |
| 103 | +puSrcName pu |
| 104 | + | Just n <- sourceName (getAnnotation pu) = Named n |
| 105 | + | otherwise = getName pu |
| 106 | + |
101 | 107 | -- | Create analysis annotations for the program, saving the original
|
102 | 108 | -- annotations.
|
103 | 109 | initAnalysis :: Functor b => b a -> b (Analysis a)
|
|
0 commit comments