1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 13:51:44 +03:00

Add ReferenceError

This commit is contained in:
joshvera 2018-11-15 20:23:43 -05:00
parent ea7a576c31
commit 994fd861c5

View File

@ -140,29 +140,34 @@ data EvalError address value return where
DefaultExportError :: EvalError address value () DefaultExportError :: EvalError address value ()
ExportError :: ModulePath -> Name -> EvalError address value () ExportError :: ModulePath -> Name -> EvalError address value ()
AssignmentRvalError :: value -> EvalError address value (ValueRef address value) AssignmentRvalError :: value -> EvalError address value (ValueRef address value)
ReferenceError :: value -> Name -> EvalError address value (ValueRef address value)
deriving instance (Eq address, Eq value) => Eq (EvalError address value return) deriving instance (Eq address, Eq value) => Eq (EvalError address value return)
deriving instance (Show address, Show value) => Show (EvalError address value return) deriving instance (Show address, Show value) => Show (EvalError address value return)
instance NFData1 (EvalError address value) where instance NFData value => NFData1 (EvalError address value) where
liftRnf _ x = case x of liftRnf _ x = case x of
NoNameError -> () AssignmentRvalError v -> rnf v
IntegerFormatError i -> rnf i
FloatFormatError i -> rnf i
RationalFormatError i -> rnf i
DefaultExportError -> () DefaultExportError -> ()
ExportError p n -> rnf p `seq` rnf n ExportError p n -> rnf p `seq` rnf n
FloatFormatError i -> rnf i
IntegerFormatError i -> rnf i
NoNameError -> ()
RationalFormatError i -> rnf i
ReferenceError v n -> rnf v `seq` rnf n
instance (NFData address, NFData value, NFData return) => NFData (EvalError address value return) where instance (NFData address, NFData value, NFData return) => NFData (EvalError address value return) where
rnf = liftRnf rnf rnf = liftRnf rnf
instance Eq1 (EvalError address value) where instance Eq value => Eq1 (EvalError address value) where
liftEq _ NoNameError NoNameError = True liftEq _ (AssignmentRvalError v) (AssignmentRvalError v2) = v == v2
liftEq _ DefaultExportError DefaultExportError = True liftEq _ DefaultExportError DefaultExportError = True
liftEq _ (ExportError a b) (ExportError c d) = (a == c) && (b == d) liftEq _ (ExportError a b) (ExportError c d) = (a == c) && (b == d)
liftEq _ (IntegerFormatError a) (IntegerFormatError b) = a == b
liftEq _ (FloatFormatError a) (FloatFormatError b) = a == b liftEq _ (FloatFormatError a) (FloatFormatError b) = a == b
liftEq _ (IntegerFormatError a) (IntegerFormatError b) = a == b
liftEq _ NoNameError NoNameError = True
liftEq _ (RationalFormatError a) (RationalFormatError b) = a == b liftEq _ (RationalFormatError a) (RationalFormatError b) = a == b
liftEq _ (ReferenceError v n) (ReferenceError v2 n2) = (v == v2) && (n == n2)
liftEq _ _ _ = False liftEq _ _ _ = False
instance (Show address, Show value) => Show1 (EvalError address value) where instance (Show address, Show value) => Show1 (EvalError address value) where