1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

Add Assignment, MemberAccess, MethodCall, Args cases to alignSyntax

This commit is contained in:
joshvera 2016-06-14 11:27:48 -07:00
parent 307cdda0de
commit 4b52268f94

View File

@ -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