1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Fix up methodDefinition

This commit is contained in:
joshvera 2017-08-11 15:54:46 -04:00
parent a9c98d06c6
commit 2b1d782c99

View File

@ -183,15 +183,16 @@ readonly' = symbol Readonly *> children source
methodDefinition :: Assignment methodDefinition :: Assignment
methodDefinition = makeVisibility <$> methodDefinition = makeVisibility <$>
symbol MethodDefinition symbol MethodDefinition
<*> children ((,,,,) <$> optional accessibilityModifier' <*> optional readonly' <*> propertyName <*> callSignature <*> statementBlock) <*> children ((,,,,,) <$> optional accessibilityModifier' <*> optional readonly' <*> emptyTerm <*> propertyName <*> callSignature <*> statements)
where where
makeVisibility loc (modifier, readonly, propertyName, callSignature, statements) = maybe method' (Type.Visibility <$> (makeReadonly loc method' readonly) <*>) modifier 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' = makeTerm loc (Declaration.Method <$> propertyName <*> callSignature <*> statements) where method'' = method' loc empty propertyName callSignature statements
makeReadonly loc term = maybe term (makeTerm loc . const (Type.Readonly term))
method' = makeTerm loc (Declaration.Method <$> propertyName <*> callSignature <*> statements)
statementBlock :: Assignment method' loc term name signature statements = makeTerm loc (Declaration.Method term name signature statements)
statementBlock = symbol StatementBlock *> many statement makeReadonly loc = makeTerm loc . Type.Readonly
statements :: Assignment
statements = makeTerm <$> location <*> many statement
statement :: Assignment statement :: Assignment
statement = statement =