From 4b52268f94bfcb6ffc6c42e35751a35ebfdde74e Mon Sep 17 00:00:00 2001 From: joshvera Date: Tue, 14 Jun 2016 11:27:48 -0700 Subject: [PATCH] Add Assignment, MemberAccess, MethodCall, Args cases to alignSyntax --- src/Alignment.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Alignment.hs b/src/Alignment.hs index 00d1a76c0..25e33d3a7 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -68,6 +68,14 @@ alignSyntax toJoinThese toNode getRange sources (infos :< syntax) = case syntax Syntax.Function id params body -> catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (fromMaybe [] id <> fromMaybe [] params <> body) bothRanges -- Align FunctionCalls like Indexed nodes by appending identifier to its children. Syntax.FunctionCall identifier children -> catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (join (identifier : children)) bothRanges + Syntax.Assignment assignmentId value -> + catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (assignmentId <> value) bothRanges + Syntax.MemberAccess memberId property -> + catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (memberId <> property) bothRanges + Syntax.MethodCall targetId methodId args -> + catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (targetId <> methodId <> args) bothRanges + Syntax.Args children -> + catMaybes $ wrapInBranch Indexed <$> alignBranch getRange (join children) bothRanges Fixed children -> catMaybes $ wrapInBranch Fixed <$> alignBranch getRange (join children) bothRanges Keyed children -> catMaybes $ wrapInBranch (Keyed . Map.fromList) <$> alignBranch (getRange . Prologue.snd) (Map.toList children >>= pairWithKey) bothRanges where bothRanges = modifyJoin (fromThese [] []) lineRanges