1
1
mirror of https://github.com/github/semantic.git synced 2025-01-06 23:46:21 +03:00

Allow allocation in assignment again

This commit is contained in:
Timothy Clem 2018-04-12 14:22:55 -07:00
parent 01d3e7d547
commit 97a566e973

View File

@ -96,6 +96,13 @@ instance Show1 Assignment where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable Assignment where instance Evaluatable Assignment where
eval Assignment{..} = do eval Assignment{..} = do
case freeVariables (subterm assignmentTarget) of
[name] -> do
v <- subtermValue assignmentValue
addr <- lookupOrAlloc name
assign addr v
modifyEnv (Env.insert name addr) $> v
_ -> do
lhs <- subtermValue assignmentTarget >>= scopedEnvironment lhs <- subtermValue assignmentTarget >>= scopedEnvironment
localEnv (mappend lhs) (subtermValue assignmentValue) localEnv (mappend lhs) (subtermValue assignmentValue)