1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00

Remove comments

This commit is contained in:
Rick Winfrey 2016-10-19 18:06:34 -05:00
parent c64056894d
commit 84d2f7ae36

View File

@ -218,7 +218,6 @@ toTermName source term = case unwrap term of
S.Commented _ _ -> termNameFromChildren term (toList $ unwrap term)
S.Module identifier _ -> toTermName' identifier
S.Import identifier [] -> termNameFromSource identifier
S.Import identifier expr@[_] -> termNameFromChildren term (removeIndexedNode expr) <> " from " <> toTermName' identifier
S.Import identifier exprs -> termNameFromChildren term exprs <> " from " <> toTermName' identifier
S.Export Nothing expr -> "{ " <> intercalate ", " (termNameFromSource <$> expr) <> " }"
S.Export (Just identifier) [] -> "{ " <> toTermName' identifier <> " }"
@ -229,14 +228,6 @@ toTermName source term = case unwrap term of
termNameFromRange range = toText $ Source.slice range source
range = characterRange . extract
paramsToArgNames params = "(" <> intercalate ", " (toArgName <$> params) <> ")"
-- | For Import Syntaxes, unnamed nodes at the start or the end of a source are captured in a parent Indexed node.
-- | This in some cases can lead to us slicing a source based on the range of the Indexed node, rather than the children.
-- | This can cause us to add extra characters beyond the ranges of the Indexed nodes children.
-- | removeIndexedNode strips the containing Indexed nodes from a list of expressions to get the ranges of the children,
-- | so when we unionRanges we can ensure the union of ranges accounts only for children, and not the sometimes misleading Indexed node's ranges.
removeIndexedNode = concatMap (\term -> case unwrap term of
S.Indexed children -> removeIndexedNode children
_ -> [term])
toArgName :: SyntaxTerm leaf fields -> Text
toArgName arg = case identifiable arg of
Identifiable arg -> toTermName' arg