Skip to content

Commit

Permalink
Removing an unnessacary variable lookup in evalExpr'
Browse files Browse the repository at this point in the history
  • Loading branch information
lepsa committed Nov 4, 2022
1 parent a3b4ddc commit 5de243b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Graphics/Implicit/ExtOpenScad/Eval/Expr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import Graphics.Implicit.ExtOpenScad.Util.StateC (getVarLookup)

import qualified Graphics.Implicit.ExtOpenScad.Util.StateC as GIEUS (addMessage)

import Control.Applicative ((<|>))

import Data.Maybe (fromMaybe, isNothing)

import Data.Map (fromList, lookup)
Expand Down Expand Up @@ -148,7 +146,7 @@ evalExpr' (Var (Symbol name)) = do
-- it is possible that a name is pushed and then used before a value is pushed
-- and this zip neatly handles that situation.
zip namestack l
in fromMaybe OUndefined $ m <|> lookup (Symbol name) varlookup
in fromMaybe OUndefined m
(Just o, _) -> pure $ const o
_ -> do
errorE spos ("Variable " <> name <> "not in scope")
Expand Down

0 comments on commit 5de243b

Please sign in to comment.