1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +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 case declaredName (subterm assignmentValue) of
Just rhsName -> do Just rhsName -> do
assocScope <- associatedScope (Declaration rhsName) assocScope <- associatedScope (Declaration rhsName)
let edges = maybe mempty (Map.singleton I . pure) assocScope case assocScope of
objectScope <- newScope edges Just assocScope' -> do
putDeclarationScope (Declaration name) objectScope objectScope <- newScope (Map.singleton I [ assocScope' ])
putDeclarationScope (Declaration name) objectScope
Nothing -> pure ()
Nothing -> Nothing ->
-- The rhs wasn't assigned to a reference/declaration. -- The rhs wasn't assigned to a reference/declaration.
pure () pure ()