Skip to content

Commit 33d604a

Browse files
committed
genVar sensitive to generation of ValIntrinsic automatically based on annotation
1 parent 7ca151b commit 33d604a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Language/Fortran/Analysis.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ srcName _ = error "Use of srcName on non-variable."
126126

127127
-- | Generate an ExpValue variable with its source name == to its uniqueName.
128128
genVar :: Analysis a -> SrcSpan -> String -> Expression (Analysis a)
129-
genVar a s n = ExpValue (a { uniqueName = Just n, sourceName = Just n }) s (ValVariable n)
129+
genVar a s n = ExpValue (a { uniqueName = Just n, sourceName = Just n }) s v
130+
where
131+
v | Just CTIntrinsic <- idCType =<< idType a = ValIntrinsic n
132+
| otherwise = ValVariable n
130133

131134
-- | Obtain either ProgramUnit uniqueName or whatever is in the AST.
132135
puName :: ProgramUnit (Analysis a) -> ProgramUnitName

0 commit comments

Comments
 (0)