1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Cover all New cases

This commit is contained in:
joshvera 2018-09-14 18:50:22 -04:00
parent 7d287a8ca7
commit 4e28c3aa0c

View File

@ -2,7 +2,6 @@
{-# OPTIONS_GHC -Wno-missing-export-lists #-}
module Data.Syntax.Expression where
import qualified Data.Map.Strict as Map
import Control.Abstract.ScopeGraph as ScopeGraph
import Data.Abstract.Evaluatable hiding (Member)
import Data.Abstract.Number (liftIntegralFrac, liftReal, liftedExponent, liftedFloorDiv)
@ -550,9 +549,12 @@ instance Show1 New where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for New
instance Evaluatable New where
eval (New [subject]) = do
name <- maybeM (throwEvalError NoNameError) (declaredName (subterm subject))
reference (Reference name) (Declaration name)
eval New{..} = do
case newSubject of
[] -> pure ()
(subject : _) -> do
name <- maybeM (throwEvalError NoNameError) (declaredName (subterm subject))
reference (Reference name) (Declaration name)
-- TODO: Traverse subterms and instantiate frames from the corresponding scope
rvalBox unit