1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 02:14:20 +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
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 ()