1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Merge remote-tracking branch 'origin/master' into rws-large-diffs

This commit is contained in:
joshvera 2016-08-26 15:51:19 -04:00
commit c6d09043e8

View File

@ -127,7 +127,7 @@ toTermName source term = case unwrap term of
S.Return expr -> maybe "empty" toTermName' expr
S.Error _ _ -> termNameFromSource term
S.If expr _ _ -> termNameFromSource expr
S.For _ _ -> termNameFromChildren term
S.For clauses _ -> termNameFromChildren term clauses
S.While expr _ -> toTermName' expr
S.DoWhile _ expr -> toTermName' expr
S.Throw expr -> termNameFromSource expr
@ -137,9 +137,9 @@ toTermName source term = case unwrap term of
S.Class identifier _ _ -> toTermName' identifier
S.Method identifier _ _ -> toTermName' identifier
S.Comment a -> toCategoryName a
S.Commented _ _ -> termNameFromChildren term
S.Commented _ _ -> termNameFromChildren term (toList $ unwrap term)
where toTermName' = toTermName source
termNameFromChildren term = termNameFromRange (unionRangesFrom (range term) (range <$> toList (unwrap term)))
termNameFromChildren term children = termNameFromRange (unionRangesFrom (range term) (range <$> children))
termNameFromSource term = termNameFromRange (range term)
termNameFromRange range = toText $ Source.slice range source
range = characterRange . extract