From 55481c99df972ed70a21c9b7eab11ce9ff34ed53 Mon Sep 17 00:00:00 2001 From: Dominic Orchard Date: Thu, 12 Sep 2024 10:32:10 +0100 Subject: [PATCH] cleanup and comments --- src/Language/Fortran/Analysis/DataFlow.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Language/Fortran/Analysis/DataFlow.hs b/src/Language/Fortran/Analysis/DataFlow.hs index ab102a3e..b644c25e 100644 --- a/src/Language/Fortran/Analysis/DataFlow.hs +++ b/src/Language/Fortran/Analysis/DataFlow.hs @@ -409,9 +409,11 @@ genConstExpMap pf = ceMap Nothing -> map)) recursivelyProcessDecls stmts + -- Evaluate an expression down to a value getE0 :: M.Map Name Repr.FValue -> Expression (Analysis a) -> Maybe (Repr.FValue) getE0 pvMap e = either (const Nothing) (Just . fst) (Repr.runEvalFValuePure pvMap (Repr.evalExpr e)) + -- Lookup an expression in the constants maps getE :: Expression (Analysis a) -> Maybe Repr.FValue getE = join . (flip IM.lookup ceMap <=< labelOf) @@ -422,10 +424,7 @@ genConstExpMap pf = ceMap -- TODO constants may use other constants! but genConstExpMap needs more -- changes to support that case Repr.runEvalFValuePure pvMap (Repr.evalExpr e) of - Left _err -> - case e of - ExpValue _ _ (ValVariable{}) -> Nothing - _ -> Nothing + Left _err -> Nothing Right (a, _msgs) -> case e of ExpValue _ _ (ValVariable{}) -> Just a