diff --git a/src/Control/Abstract/Heap.hs b/src/Control/Abstract/Heap.hs index d69a6b42c..e57dbe2b3 100644 --- a/src/Control/Abstract/Heap.hs +++ b/src/Control/Abstract/Heap.hs @@ -10,7 +10,6 @@ module Control.Abstract.Heap , alloc , deref , assign -, lookupOrAlloc , letrec , letrec' , variable diff --git a/src/Data/Syntax/Declaration.hs b/src/Data/Syntax/Declaration.hs index 070370934..8e5d59fa4 100644 --- a/src/Data/Syntax/Declaration.hs +++ b/src/Data/Syntax/Declaration.hs @@ -256,9 +256,7 @@ instance Show1 TypeAlias where liftShowsPrec = genericLiftShowsPrec instance Evaluatable TypeAlias where eval TypeAlias{..} = do name <- maybeM (throwEvalError NoNameError) (declaredName (subterm typeAliasIdentifier)) - v <- subtermValue typeAliasKind - addr <- lookupOrAlloc name - assign addr v + addr <- subtermAddress typeAliasKind bind name addr pure (Rval addr) diff --git a/src/Data/Syntax/Statement.hs b/src/Data/Syntax/Statement.hs index 61f8fd7ee..166d8811f 100644 --- a/src/Data/Syntax/Statement.hs +++ b/src/Data/Syntax/Statement.hs @@ -118,13 +118,11 @@ instance Show1 Assignment where liftShowsPrec = genericLiftShowsPrec instance Evaluatable Assignment where eval Assignment{..} = do lhs <- subtermRef assignmentTarget - rhs <- subtermValue assignmentValue + rhs <- subtermAddress assignmentValue case lhs of LvalLocal nam -> do - addr <- lookupOrAlloc nam - assign addr rhs - bind nam addr + bind nam rhs LvalMember _ _ -> -- we don't yet support mutable object properties: pure () @@ -132,7 +130,7 @@ instance Evaluatable Assignment where -- the left hand side of the assignment expression is invalid: pure () - rvalBox rhs + pure (Rval rhs) -- | Post increment operator (e.g. 1++ in Go, or i++ in C). newtype PostIncrement a = PostIncrement a diff --git a/src/Language/TypeScript/Syntax/TypeScript.hs b/src/Language/TypeScript/Syntax/TypeScript.hs index c7b78c7a6..18383dc59 100644 --- a/src/Language/TypeScript/Syntax/TypeScript.hs +++ b/src/Language/TypeScript/Syntax/TypeScript.hs @@ -110,9 +110,7 @@ instance Evaluatable DefaultExport where eval (DefaultExport term) = do case declaredName term of Just name -> do - addr <- lookupOrAlloc name - v <- subtermValue term - assign addr v + addr <- subtermAddress term export name name Nothing bind name addr Nothing -> throwEvalError DefaultExportError