1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 13:21:59 +03:00

Don't construct new scopes for every local assignment

Only construct a new scope for a local assignment if its rhs has an associated scope.
This commit is contained in:
joshvera 2018-09-17 13:29:50 -04:00
parent 659c51305f
commit 82b6b7c52e

View File

@ -146,9 +146,11 @@ instance Evaluatable Assignment where
case declaredName (subterm assignmentValue) of
Just rhsName -> do
assocScope <- associatedScope (Declaration rhsName)
let edges = maybe mempty (Map.singleton I . pure) assocScope
objectScope <- newScope edges
putDeclarationScope (Declaration name) objectScope
case assocScope of
Just assocScope' -> do
objectScope <- newScope (Map.singleton I [ assocScope' ])
putDeclarationScope (Declaration name) objectScope
Nothing -> pure ()
Nothing ->
-- The rhs wasn't assigned to a reference/declaration.
pure ()