1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Add computed property names

This commit is contained in:
joshvera 2017-09-20 14:13:15 -04:00
parent 9ac6e68220
commit d789eb2b18
2 changed files with 12 additions and 2 deletions

View File

@ -171,6 +171,7 @@ type Syntax = '[
, Language.TypeScript.Syntax.Await
, Language.TypeScript.Syntax.PublicFieldDefinition
, Language.TypeScript.Syntax.VariableDeclaration
, Language.TypeScript.Syntax.ComputedPropertyName
, Type.Visibility
, []
]
@ -269,6 +270,12 @@ data Annotation a = Annotation { typeAnnotation :: !a }
instance Eq1 Annotation where liftEq = genericLiftEq
instance Show1 Annotation where liftShowsPrec = genericLiftShowsPrec
data ComputedPropertyName a = ComputedPropertyName !a
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
instance Eq1 ComputedPropertyName where liftEq = genericLiftEq
instance Show1 ComputedPropertyName where liftShowsPrec = genericLiftShowsPrec
data Constraint a = Constraint { constraintType :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
@ -1107,7 +1114,10 @@ propertySignature = makePropertySignature <$> symbol Grammar.PropertySignature <
where makePropertySignature loc (modifier, readonly, propertyName, annotation) = makeTerm loc (Language.TypeScript.Syntax.PropertySignature [modifier, readonly, annotation] propertyName)
propertyName :: Assignment
propertyName = (makeTerm <$> symbol PropertyIdentifier <*> (Syntax.Identifier <$> source)) <|> string <|> number
propertyName = (makeTerm <$> symbol PropertyIdentifier <*> (Syntax.Identifier <$> source)) <|> string <|> number <|> computedPropertyName
computedPropertyName :: Assignment
computedPropertyName = makeTerm <$> symbol Grammar.ComputedPropertyName <*> (Language.TypeScript.Syntax.ComputedPropertyName <$> expression)
assignmentPattern :: Assignment
assignmentPattern = makeTerm <$> symbol AssignmentPattern <*> children (Statement.Assignment [] <$> shorthandPropertyIdentifier <*> expression)

@ -1 +1 @@
Subproject commit acc35b3187077caa3d52bae46cf58122a5d5f3a4
Subproject commit 4387ada24215c1006e2a5ad1748984c3dbef3f91