From 910a02e931ac9903a5691a4484054210622223ab Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 19 Jun 2018 08:53:15 -0400 Subject: [PATCH] Placate hlint. --- src/Language/Go/Assignment.hs | 12 ++++++------ src/Language/Haskell/Assignment.hs | 5 ++--- src/Language/Ruby/Assignment.hs | 12 ++++++------ src/Language/TypeScript/Assignment.hs | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 9496463e8..084d77c0d 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -316,7 +316,7 @@ sliceType :: Assignment sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression) structType :: Assignment -structType = makeTerm <$> symbol StructType <*> children (Declaration.Constructor <$> pure [] <*> emptyTerm <*> expressions) +structType = makeTerm <$> symbol StructType <*> children (Declaration.Constructor [] <$> emptyTerm <*> expressions) typeAlias :: Assignment typeAlias = makeTerm <$> symbol TypeAlias <*> children (Declaration.TypeAlias [] <$> expression <*> expression) @@ -367,7 +367,7 @@ defaultExpressionCase :: Assignment defaultExpressionCase = makeTerm <$> symbol DefaultCase <*> (Go.Syntax.DefaultPattern <$ rawSource <*> (expressions <|> emptyTerm)) callExpression :: Assignment -callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> expression <*> manyTerm expression <*> emptyTerm) +callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call [] <$> expression <*> manyTerm expression <*> emptyTerm) expressionCase :: Assignment expressionCase = makeTerm <$> symbol ExpressionCase <*> (Statement.Pattern <$> children expressions <*> expressions) @@ -403,7 +403,7 @@ importDeclaration = makeTerm'' <$> symbol ImportDeclaration <*> children (manyTe plainImport = inject <$> (symbol InterpretedStringLiteral >>= \loc -> do from <- importPath <$> source let alias = makeTerm loc (Syntax.Identifier (defaultAlias from)) -- Go takes `import "lib/Math"` and uses `Math` as the qualified name (e.g. `Math.Sin()`) - Go.Syntax.QualifiedImport <$> pure from <*> pure alias) + pure $! Go.Syntax.QualifiedImport from alias) dot = makeTerm <$> symbol Dot <*> (Literal.TextElement <$> source) underscore = makeTerm <$> symbol BlankIdentifier <*> (Literal.TextElement <$> source) @@ -487,13 +487,13 @@ varDeclaration :: Assignment varDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions variadicArgument :: Assignment -variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic <$> pure [] <*> expression) +variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic [] <$> expression) variadicParameterDeclaration :: Assignment variadicParameterDeclaration = makeTerm <$> symbol VariadicParameterDeclaration <*> children (flip Go.Syntax.Variadic <$> (expression <|> emptyTerm) <* token AnonDotDotDot <*> many expression) varSpecification :: Assignment -varSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment <$> pure [] <*> (annotatedLHS <|> identifiers) <*> expressions) +varSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment [] <$> (annotatedLHS <|> identifiers) <*> expressions) where annotatedLHS = makeTerm <$> location <*> (Type.Annotation <$> (makeTerm <$> location <*> manyTermsTill identifier (void (symbol TypeIdentifier))) <*> expression) @@ -585,7 +585,7 @@ receiveStatement :: Assignment receiveStatement = makeTerm <$> symbol ReceiveStatement <*> children (Go.Syntax.Receive <$> (expression <|> emptyTerm) <*> expression) shortVarDeclaration :: Assignment -shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment <$> pure [] <*> expression <*> expression) +shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment [] <$> expression <*> expression) selectStatement :: Assignment selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions) diff --git a/src/Language/Haskell/Assignment.hs b/src/Language/Haskell/Assignment.hs index 4cb861e69..b82628a57 100644 --- a/src/Language/Haskell/Assignment.hs +++ b/src/Language/Haskell/Assignment.hs @@ -312,9 +312,8 @@ functionConstructor = makeTerm <$> token FunctionConstructor <*> pure Syntax.Fu functionDeclaration :: Assignment functionDeclaration = makeTerm <$> symbol FunctionDeclaration - <*> children (Declaration.Function - <$> pure [] - <*> variableIdentifier + <*> children (Declaration.Function [] + <$> variableIdentifier <*> (manyTermsTill expression (symbol FunctionBody) <|> pure []) <*> functionBody) diff --git a/src/Language/Ruby/Assignment.hs b/src/Language/Ruby/Assignment.hs index e90980b6b..62ee8b8da 100644 --- a/src/Language/Ruby/Assignment.hs +++ b/src/Language/Ruby/Assignment.hs @@ -271,12 +271,12 @@ parameter = postContextualize comment (term uncontextualizedParameter) optionalParameter = symbol OptionalParameter *> children (lhsIdent <* expression) method :: Assignment -method = makeTerm <$> symbol Method <*> (withNewScope . children) (Declaration.Method <$> pure [] <*> emptyTerm <*> methodSelector <*> params <*> expressions') +method = makeTerm <$> symbol Method <*> (withNewScope . children) (Declaration.Method [] <$> emptyTerm <*> methodSelector <*> params <*> expressions') where params = symbol MethodParameters *> children (many parameter) <|> pure [] expressions' = makeTerm <$> location <*> many expression singletonMethod :: Assignment -singletonMethod = makeTerm <$> symbol SingletonMethod <*> (withNewScope . children) (Declaration.Method <$> pure [] <*> expression <*> methodSelector <*> params <*> expressions) +singletonMethod = makeTerm <$> symbol SingletonMethod <*> (withNewScope . children) (Declaration.Method [] <$> expression <*> methodSelector <*> params <*> expressions) where params = symbol MethodParameters *> children (many parameter) <|> pure [] lambda :: Assignment @@ -289,18 +289,18 @@ block :: Assignment block = makeTerm <$> symbol DoBlock <*> scopedBlockChildren <|> makeTerm <$> symbol Block <*> scopedBlockChildren where scopedBlockChildren = withExtendedScope blockChildren - blockChildren = children (Declaration.Function <$> pure [] <*> emptyTerm <*> params <*> expressions) + blockChildren = children (Declaration.Function [] <$> emptyTerm <*> params <*> expressions) params = symbol BlockParameters *> children (many parameter) <|> pure [] comment :: Assignment comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) alias :: Assignment -alias = makeTerm <$> symbol Alias <*> children (Expression.Call <$> pure [] <*> name' <*> some expression <*> emptyTerm) +alias = makeTerm <$> symbol Alias <*> children (Expression.Call [] <$> name' <*> some expression <*> emptyTerm) where name' = makeTerm <$> location <*> (Syntax.Identifier . name <$> source) undef :: Assignment -undef = makeTerm <$> symbol Undef <*> children (Expression.Call <$> pure [] <*> name' <*> some expression <*> emptyTerm) +undef = makeTerm <$> symbol Undef <*> children (Expression.Call [] <$> name' <*> some expression <*> emptyTerm) where name' = makeTerm <$> location <*> (Syntax.Identifier . name <$> source) if' :: Assignment @@ -445,7 +445,7 @@ unary = symbol Unary >>= \ location -> makeTerm location . Expression.Complement <$> children ( symbol AnonTilde *> expression ) <|> makeTerm location . Expression.Not <$> children ( symbol AnonBang *> expression ) <|> makeTerm location . Expression.Not <$> children ( symbol AnonNot *> expression ) - <|> makeTerm location <$> children (Expression.Call <$> pure [] <*> (makeTerm <$> symbol AnonDefinedQuestion <*> (Syntax.Identifier . name <$> source)) <*> some expression <*> emptyTerm) + <|> makeTerm location <$> children (Expression.Call [] <$> (makeTerm <$> symbol AnonDefinedQuestion <*> (Syntax.Identifier . name <$> source)) <*> some expression <*> emptyTerm) <|> makeTerm location . Expression.Negate <$> children ( symbol AnonMinus' *> expression ) <|> children ( symbol AnonPlus *> expression ) diff --git a/src/Language/TypeScript/Assignment.hs b/src/Language/TypeScript/Assignment.hs index 79a13c9bc..f663056cb 100644 --- a/src/Language/TypeScript/Assignment.hs +++ b/src/Language/TypeScript/Assignment.hs @@ -291,7 +291,7 @@ null' :: Assignment null' = makeTerm <$> symbol Null <*> (Literal.Null <$ rawSource) anonymousClass :: Assignment -anonymousClass = makeTerm <$> symbol Grammar.AnonymousClass <*> children (Declaration.Class <$> pure [] <*> emptyTerm <*> (classHeritage' <|> pure []) <*> classBodyStatements) +anonymousClass = makeTerm <$> symbol Grammar.AnonymousClass <*> children (Declaration.Class [] <$> emptyTerm <*> (classHeritage' <|> pure []) <*> classBodyStatements) abstractClass :: Assignment abstractClass = makeTerm <$> symbol Grammar.AbstractClass <*> children (TypeScript.Syntax.AbstractClass <$> term identifier <*> (term typeParameters <|> emptyTerm) <*> (classHeritage' <|> pure []) <*> classBodyStatements)