1
1
mirror of https://github.com/github/semantic.git synced 2025-01-08 08:30:27 +03:00

Move InterfaceDeclaration to Declaration.hs

This commit is contained in:
joshvera 2017-10-02 13:18:38 -07:00
parent 9f62cadd9b
commit 232a702f6f
2 changed files with 9 additions and 8 deletions

View File

@ -44,6 +44,13 @@ newtype VariableDeclaration a = VariableDeclaration { variableDeclarations :: [a
instance Eq1 VariableDeclaration where liftEq = genericLiftEq
instance Show1 VariableDeclaration where liftShowsPrec = genericLiftShowsPrec
-- | A TypeScript/Java style interface declaration to implement.
data InterfaceDeclaration a = InterfaceDeclaration { interfaceDeclarationContext :: ![a], interfaceDeclarationIdentifier :: !a, interfaceDeclarationBody :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
instance Eq1 InterfaceDeclaration where liftEq = genericLiftEq
instance Show1 InterfaceDeclaration where liftShowsPrec = genericLiftShowsPrec
-- | A public field definition such as a field definition in a JavaScript class.
data PublicFieldDefinition a = PublicFieldDefinition { publicFieldContext :: ![a], publicFieldPropertyName :: !a, publicFieldValue :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)

View File

@ -40,6 +40,7 @@ type Syntax = '[
, Declaration.Class
, Declaration.Function
, Declaration.Method
, Declaration.InterfaceDeclaration
, Declaration.PublicFieldDefinition
, Declaration.VariableDeclaration
, Declaration.Module
@ -150,7 +151,6 @@ type Syntax = '[
, Language.TypeScript.Syntax.ExportClause
, Language.TypeScript.Syntax.Export
, Language.TypeScript.Syntax.AmbientDeclaration
, Language.TypeScript.Syntax.InterfaceDeclaration
, Language.TypeScript.Syntax.EnumDeclaration
, Language.TypeScript.Syntax.TypeAliasDeclaration
, Language.TypeScript.Syntax.ExtendsClause
@ -356,12 +356,6 @@ newtype AmbientDeclaration a = AmbientDeclaration { _ambientDeclarationBody :: a
instance Eq1 AmbientDeclaration where liftEq = genericLiftEq
instance Show1 AmbientDeclaration where liftShowsPrec = genericLiftShowsPrec
data InterfaceDeclaration a = InterfaceDeclaration { _interfaceDeclarationContext :: ![a], _interfaceDeclarationIdentifier :: !a, _interfaceDeclarationBody :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
instance Eq1 InterfaceDeclaration where liftEq = genericLiftEq
instance Show1 InterfaceDeclaration where liftShowsPrec = genericLiftShowsPrec
data EnumDeclaration a = EnumDeclaration { _enumDeclarationIdentifier :: !a, _enumDeclarationBody :: ![a] }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
@ -1058,7 +1052,7 @@ enumAssignment = makeTerm <$> symbol Grammar.EnumAssignment <*> children (Statem
interfaceDeclaration :: Assignment
interfaceDeclaration = makeInterfaceDecl <$> symbol Grammar.InterfaceDeclaration <*> children ((,,,) <$> identifier <*> (typeParameters <|> emptyTerm) <*> (extendsClause <|> emptyTerm) <*> objectType)
where makeInterfaceDecl loc (identifier, typeParams, clause, objectType) = makeTerm loc (Language.TypeScript.Syntax.InterfaceDeclaration [typeParams, clause] identifier objectType)
where makeInterfaceDecl loc (identifier, typeParams, clause, objectType) = makeTerm loc (Declaration.InterfaceDeclaration [typeParams, clause] identifier objectType)
extendsClause :: Assignment
extendsClause = makeTerm <$> symbol Grammar.ExtendsClause <*> children (Language.TypeScript.Syntax.ExtendsClause <$> many (term ty))