1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 22:01:46 +03:00

Tighten up toTermName.

This commit is contained in:
Rob Rix 2017-05-08 11:16:23 -04:00
parent 76002f08c0
commit 9df2a73e38

View File

@ -165,12 +165,9 @@ toTermName parentOffset parentSource term = case unwrap term of
_ -> toMethodNameWithReceiver receiver identifier
_ -> toText source
where
source = Source.slice (offsetRange (range term) (negate parentOffset)) parentSource
source = Source.slice (offsetRange (byteRange (extract term)) (negate parentOffset)) parentSource
toMethodNameWithReceiver receiver name = toTermName' receiver <> "." <> toTermName' name
offset = start (range term)
toTermName' :: SyntaxTerm leaf fields -> Text
toTermName' = toTermName offset source
range = byteRange . extract
toTermName' = toTermName (start (byteRange (extract term))) source
-- The user-facing category name
toCategoryName :: Category -> Text