diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index a490755ee..4fea25bdd 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -135,6 +135,7 @@ expressionChoices = , typeDeclaration , typeIdentifier , unaryExpression + , variadicParameterDeclaration ] identifiers :: Assignment @@ -338,6 +339,12 @@ functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') parameters = symbol Parameters *> children (many expression) +variadicParameterDeclaration :: Assignment +variadicParameterDeclaration = mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> emptyTerm <*> expression) + <|> mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> expression <*> expression) + where + mkVariadic loc (identifier', typeIdentifier') = makeTerm loc (Go.Syntax.Variadic [typeIdentifier'] identifier') + importDeclaration :: Assignment importDeclaration = makeTerm <$> symbol ImportDeclaration <*> children (Declaration.Import <$> many expression)