1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 05:11:44 +03:00

Match against anonymous symbols for TypeScript accessibility modifiers

This commit is contained in:
Rick Winfrey 2019-01-24 16:58:37 -08:00
parent 1e187d2f57
commit 21518197b4

View File

@ -482,16 +482,10 @@ parameter = requiredParameter
<|> optionalParameter
accessibilityModifier' :: Assignment Term
accessibilityModifier' = makeTerm'
<$> symbol AccessibilityModifier
<*> children (inject <$> (textToAccessControl <$> source))
textToAccessControl :: Text -> Declaration.AccessControl a
textToAccessControl = \case
"protected" -> Declaration.Protected
"private" -> Declaration.Private
-- | The catchall case is public.
_ -> Declaration.Public
accessibilityModifier' = makeTerm <$> symbol AccessibilityModifier <*> children (public <|> protected <|> private)
where public = symbol AnonPublic *> pure Declaration.Public
protected = symbol AnonProtected *> pure Declaration.Protected
private = symbol AnonPrivate *> pure Declaration.Private
destructuringPattern :: Assignment Term
destructuringPattern = object <|> array