mirror of
https://github.com/github/semantic.git
synced 2025-01-05 05:58:34 +03:00
Allow allocation in assignment again
This commit is contained in:
parent
01d3e7d547
commit
97a566e973
@ -96,8 +96,15 @@ instance Show1 Assignment where liftShowsPrec = genericLiftShowsPrec
|
|||||||
|
|
||||||
instance Evaluatable Assignment where
|
instance Evaluatable Assignment where
|
||||||
eval Assignment{..} = do
|
eval Assignment{..} = do
|
||||||
lhs <- subtermValue assignmentTarget >>= scopedEnvironment
|
case freeVariables (subterm assignmentTarget) of
|
||||||
localEnv (mappend lhs) (subtermValue assignmentValue)
|
[name] -> do
|
||||||
|
v <- subtermValue assignmentValue
|
||||||
|
addr <- lookupOrAlloc name
|
||||||
|
assign addr v
|
||||||
|
modifyEnv (Env.insert name addr) $> v
|
||||||
|
_ -> do
|
||||||
|
lhs <- subtermValue assignmentTarget >>= scopedEnvironment
|
||||||
|
localEnv (mappend lhs) (subtermValue assignmentValue)
|
||||||
|
|
||||||
-- | Post increment operator (e.g. 1++ in Go, or i++ in C).
|
-- | Post increment operator (e.g. 1++ in Go, or i++ in C).
|
||||||
newtype PostIncrement a = PostIncrement a
|
newtype PostIncrement a = PostIncrement a
|
||||||
|
Loading…
Reference in New Issue
Block a user