1
1
mirror of https://github.com/github/semantic.git synced 2025-01-04 21:47:07 +03:00

assert statement modification

This commit is contained in:
Ayman Nadeem 2018-07-19 16:56:03 -04:00
parent 105d1a6ece
commit 9cb3a059c0
2 changed files with 3 additions and 3 deletions

View File

@ -357,7 +357,7 @@ interface = makeTerm <$> symbol InterfaceDeclaration <*> children (normal <|> an
interfaceBody = makeTerm <$> symbol InterfaceBody <*> children (manyTerm interfaceMemberDeclaration)
normal = symbol NormalInterfaceDeclaration *> children (makeInterface <$> manyTerm modifier <*> identifier <*> (typeParameters <|> pure []) <*> (extends <|> pure []) <*> interfaceBody)
makeInterface modifiers identifier typeParams = Declaration.InterfaceDeclaration (modifiers ++ typeParams) identifier
annotationType = symbol AnnotationTypeDeclaration *> children (Declaration.InterfaceDeclaration [] <$> identifier <*> pure [] <*> annotationTypeBody)
annotationType = symbol AnnotationTypeDeclaration *> children (Declaration.InterfaceDeclaration [] <$> AnonAt *> identifier <*> pure [] <*> annotationTypeBody)
annotationTypeBody = makeTerm <$> symbol AnnotationTypeBody <*> children (many expression)
interfaceMemberDeclaration = symbol InterfaceMemberDeclaration *> children (term expression)
extends = symbol ExtendsInterfaces *> children (symbol InterfaceTypeList *> children (manyTerm type'))
@ -476,7 +476,7 @@ enhancedFor = makeTerm <$> symbol EnhancedForStatement <*> children (Statement.F
where variable modifiers type' variableDeclaratorId = makeTerm1 (Java.Syntax.Variable modifiers type' variableDeclaratorId)
assert :: Assignment Term
assert = makeTerm <$> symbol Grammar.AssertStatement <*> children (Java.Syntax.AssertStatement <$> term expression <*> term expression)
assert = makeTerm <$> symbol Grammar.AssertStatement <*> children (Java.Syntax.AssertStatement <$> term expression <*> optional (term expression))
-- TODO: instanceOf
binary :: Assignment Term

View File

@ -273,7 +273,7 @@ instance Show1 TryWithResources where liftShowsPrec = genericLiftShowsPrec
-- TODO: Implement Eval instance for TryWithResources
instance Evaluatable TryWithResources
data AssertStatement a = AssertStatement { assertLHS :: !a, assertRHS :: !a }
data AssertStatement a = AssertStatement { assertLHS :: !a, assertRHS :: !(Maybe a) }
deriving (Declarations1, Diffable, Eq, Foldable, FreeVariables1, Functor, Generic1, Hashable1, Mergeable, Ord, Show, ToJSONFields1, Traversable)
instance Eq1 AssertStatement where liftEq = genericLiftEq