1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

Merge branch 'master' into error-context

This commit is contained in:
Rob Rix 2018-08-07 09:26:12 -04:00 committed by GitHub
commit cdfef7a083
4 changed files with 5 additions and 12 deletions

View File

@ -10,7 +10,6 @@ module Control.Abstract.Heap
, alloc
, deref
, assign
, lookupOrAlloc
, letrec
, letrec'
, variable

View File

@ -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)

View File

@ -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

View File

@ -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