1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Update Go assignment

This commit is contained in:
Rick Winfrey 2018-12-17 17:51:44 -08:00
parent 5dab74f5ea
commit 3193481ea8

View File

@ -31,6 +31,7 @@ import Data.ImportPath (importPath, defaultAlias)
type Syntax =
'[ Comment.Comment
, Declaration.Accessibility
, Declaration.Constructor
, Declaration.Function
, Declaration.Method
@ -458,11 +459,12 @@ indexExpression :: Assignment Term
indexExpression = makeTerm <$> symbol IndexExpression <*> children (Expression.Subscript <$> expression <*> manyTerm expression)
methodDeclaration :: Assignment Term
methodDeclaration = makeTerm <$> symbol MethodDeclaration <*> children (mkTypedMethodDeclaration <$> receiver <*> term fieldIdentifier <*> params <*> returnParameters <*> (term block <|> emptyTerm))
methodDeclaration = makeTerm <$> symbol MethodDeclaration <*> children (mkTypedMethodDeclaration <$> receiver <*> accessibility <*> term fieldIdentifier <*> params <*> returnParameters <*> (term block <|> emptyTerm))
where
params = symbol ParameterList *> children (manyTerm expression)
receiver = symbol ParameterList *> children expressions
mkTypedMethodDeclaration receiver' name' parameters' type'' body' = Declaration.Method type'' receiver' name' parameters' body'
mkTypedMethodDeclaration receiver' accessibility' name' parameters' type'' body' = Declaration.Method type'' accessibility' receiver' name' parameters' body'
accessibility = makeTerm <$> location <*> pure Declaration.Unknown
returnParameters = (symbol ParameterList *> children (manyTerm expression))
<|> pure <$> expression
<|> pure []