From 2b1d782c9992b87c843efe04a6c4e3b3b09a103f Mon Sep 17 00:00:00 2001 From: joshvera Date: Fri, 11 Aug 2017 15:54:46 -0400 Subject: [PATCH] Fix up methodDefinition --- src/Language/TypeScript/Syntax.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Language/TypeScript/Syntax.hs b/src/Language/TypeScript/Syntax.hs index 68e9ce653..2933e62ca 100644 --- a/src/Language/TypeScript/Syntax.hs +++ b/src/Language/TypeScript/Syntax.hs @@ -183,15 +183,16 @@ readonly' = symbol Readonly *> children source methodDefinition :: Assignment methodDefinition = makeVisibility <$> symbol MethodDefinition - <*> children ((,,,,) <$> optional accessibilityModifier' <*> optional readonly' <*> propertyName <*> callSignature <*> statementBlock) + <*> children ((,,,,,) <$> optional accessibilityModifier' <*> optional readonly' <*> emptyTerm <*> propertyName <*> callSignature <*> statements) where - makeVisibility loc (modifier, readonly, propertyName, callSignature, statements) = maybe method' (Type.Visibility <$> (makeReadonly loc method' readonly) <*>) modifier - where method' = makeTerm loc (Declaration.Method <$> propertyName <*> callSignature <*> statements) - makeReadonly loc term = maybe term (makeTerm loc . const (Type.Readonly term)) - method' = makeTerm loc (Declaration.Method <$> propertyName <*> callSignature <*> statements) + makeVisibility loc (modifier, empty, readonly, propertyName, callSignature, statements) = maybe method'' (\x -> makeTerm loc (Type.Visibility (maybe method'' (const (makeReadonly loc method'')) readonly) x)) modifier + where method'' = method' loc empty propertyName callSignature statements -statementBlock :: Assignment -statementBlock = symbol StatementBlock *> many statement + method' loc term name signature statements = makeTerm loc (Declaration.Method term name signature statements) + makeReadonly loc = makeTerm loc . Type.Readonly + +statements :: Assignment +statements = makeTerm <$> location <*> many statement statement :: Assignment statement =