From 21518197b4aa2b7f9e7ec3f3ba723057ef4fbe5f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 24 Jan 2019 16:58:37 -0800 Subject: [PATCH] Match against anonymous symbols for TypeScript accessibility modifiers --- src/Language/TypeScript/Assignment.hs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Language/TypeScript/Assignment.hs b/src/Language/TypeScript/Assignment.hs index 870018bc8..b9125d339 100644 --- a/src/Language/TypeScript/Assignment.hs +++ b/src/Language/TypeScript/Assignment.hs @@ -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