From 82b6b7c52e633928d73ec57426b3756ca4e18ad0 Mon Sep 17 00:00:00 2001 From: joshvera Date: Mon, 17 Sep 2018 13:29:50 -0400 Subject: [PATCH] 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. --- src/Data/Syntax/Statement.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Data/Syntax/Statement.hs b/src/Data/Syntax/Statement.hs index 5cd8330d1..bf7135db5 100644 --- a/src/Data/Syntax/Statement.hs +++ b/src/Data/Syntax/Statement.hs @@ -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 ()