1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Assign function declarations whose return type is a list of parameters

This commit is contained in:
Rick Winfrey 2017-11-01 10:48:05 -07:00
parent f1cc872285
commit b6e281a0aa

View File

@ -385,9 +385,10 @@ expressionList :: Assignment
expressionList = symbol ExpressionList *> children expressions
functionDeclaration :: Assignment
functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> emptyTerm) <*> block)
functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> parameters' <|> emptyTerm) <*> block)
where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block')
parameters = symbol Parameters *> children (many expression)
parameters' = makeTerm <$> symbol Parameters <*> children (many expression)
variadicParameterDeclaration :: Assignment
variadicParameterDeclaration = mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> emptyTerm <*> expression)