Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
- Renamed `isOperatorApplication` to `isOperation`
- Renamed `RecordExpr` to `Record`
- Renamed `CaseExpression` to `Case`
- Renamed `LetExpression` to `Let`
- `LetExpression`
- Renamed `LetExpression` to `Let`
- Changed `LetFunction` so that it doesn't take an optional documentation, as that is invalid syntax.
- Renamed `GLSLExpression` to `GLSL`
- `UnitExpr` -> `TupleExpression []`
- `ParenthesizedExpression x` -> `TupleExpression [ x ]`
Expand Down
6 changes: 2 additions & 4 deletions src/Elm/Parser/Expression.elm
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,7 @@ letFunction =
, syntax =
Node { start = startNameStart, end = expressionRange.end }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = startNameStart, end = expressionRange.end }
{ name = startNameNode
Expand All @@ -780,8 +779,7 @@ letFunction =
, syntax =
Node { start = startNameStart, end = expressionRange.end }
(LetFunction
{ documentation = Nothing
, signature = Just (Node.combine Signature startNameNode signature.typeAnnotation)
{ signature = Just (Node.combine Signature startNameNode signature.typeAnnotation)
, declaration =
Node { start = implementationNameRange.start, end = expressionRange.end }
{ name = signature.implementationName
Expand Down
2 changes: 1 addition & 1 deletion src/Elm/Syntax/Expression.elm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ type alias LetBlock =
{-| Union type for all possible declarations in a let block
-}
type LetDeclaration
= LetFunction Function
= LetFunction { signature : Maybe (Node Signature), declaration : Node FunctionImplementation }
| LetDestructuring (Node DestructurePattern) (Node Expression)


Expand Down
9 changes: 3 additions & 6 deletions tests/Elm/Parser/DeclarationsTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ foo = bar"""
{ declarations =
[ Node { start = { row = 3, column = 5 }, end = { row = 5, column = 18 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 3, column = 5 }, end = { row = 5, column = 18 } }
{ name = Node { start = { row = 3, column = 5 }, end = { row = 3, column = 6 } } "y"
Expand All @@ -114,8 +113,7 @@ foo = bar"""
)
, Node { start = { row = 6, column = 5 }, end = { row = 6, column = 10 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 6, column = 5 }, end = { row = 6, column = 10 } }
{ name = Node { start = { row = 6, column = 5 }, end = { row = 6, column = 6 } } "a"
Expand Down Expand Up @@ -176,8 +174,7 @@ foo = bar"""
{ declarations =
[ Node { start = { row = 3, column = 3 }, end = { row = 3, column = 8 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 3, column = 3 }, end = { row = 3, column = 8 } }
{ name = Node { start = { row = 3, column = 3 }, end = { row = 3, column = 4 } } "b"
Expand Down
3 changes: 1 addition & 2 deletions tests/Elm/Parser/FileTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ letWhitespace = let
{ declarations =
[ Node { start = { row = 5, column = 19 }, end = { row = 5, column = 26 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 5, column = 19 }, end = { row = 5, column = 26 } }
{ name = Node { start = { row = 5, column = 19 }, end = { row = 5, column = 20 } } "b"
Expand Down
33 changes: 11 additions & 22 deletions tests/Elm/Parser/LetExpressionTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 12 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 2, column = 3 }, end = { row = 2, column = 12 } }
{ name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "foo"
Expand All @@ -37,8 +36,7 @@ all =
)
, Node { start = { row = 4, column = 3 }, end = { row = 4, column = 13 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 4, column = 3 }, end = { row = 4, column = 13 } }
{ name = Node { start = { row = 4, column = 3 }, end = { row = 4, column = 7 } } "john"
Expand All @@ -64,8 +62,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
{ name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "bar"
Expand Down Expand Up @@ -106,8 +103,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
{ name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "bar"
Expand All @@ -134,8 +130,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 5 }, end = { row = 3, column = 12 } }
(LetFunction
{ documentation = Nothing
, signature =
{ signature =
Just
(Node { start = { row = 2, column = 5 }, end = { row = 2, column = 14 } }
{ name = Node { start = { row = 2, column = 5 }, end = { row = 2, column = 8 } } "bar"
Expand Down Expand Up @@ -172,8 +167,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 5 }, end = { row = 5, column = 12 } }
(LetFunction
{ documentation = Nothing
, signature =
{ signature =
Just
(Node { start = { row = 2, column = 5 }, end = { row = 2, column = 14 } }
{ name = Node { start = { row = 2, column = 5 }, end = { row = 2, column = 8 } } "bar"
Expand Down Expand Up @@ -228,8 +222,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 11 }, end = { row = 2, column = 24 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 2, column = 11 }, end = { row = 2, column = 24 } }
{ name = Node { start = { row = 2, column = 11 }, end = { row = 2, column = 14 } } "bar"
Expand Down Expand Up @@ -353,8 +346,7 @@ all =
{ declarations =
[ Node { start = { row = 1, column = 5 }, end = { row = 1, column = 29 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 1, column = 5 }, end = { row = 1, column = 29 } }
{ name = Node { start = { row = 1, column = 5 }, end = { row = 1, column = 11 } } "indent"
Expand Down Expand Up @@ -385,8 +377,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
{ name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a"
Expand All @@ -411,8 +402,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
{ name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a"
Expand All @@ -437,8 +427,7 @@ all =
{ declarations =
[ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
(LetFunction
{ documentation = Nothing
, signature = Nothing
{ signature = Nothing
, declaration =
Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
{ name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a"
Expand Down