mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Identify TypeScript and JavaScript modules
This commit is contained in:
parent
2d4d69db41
commit
3fd9b5d5b3
@ -100,6 +100,19 @@ instance ToTags Tsx.Class where
|
||||
} = yieldTag text Class loc byteRange >> gtags t
|
||||
tags t = gtags t
|
||||
|
||||
instance ToTags Tsx.Module where
|
||||
tags t@Tsx.Module
|
||||
{ ann = loc@Loc { byteRange }
|
||||
, name
|
||||
} = match name
|
||||
where
|
||||
match expr = case expr of
|
||||
Prj Tsx.Identifier { text } -> yield text
|
||||
-- TODO: Handle NestedIdentifiers and Strings
|
||||
-- Prj Tsx.NestedIdentifier { extraChildren } -> match
|
||||
_ -> gtags t
|
||||
yield text = yieldTag text Module loc byteRange >> gtags t
|
||||
|
||||
instance (ToTags l, ToTags r) => ToTags (l :+: r) where
|
||||
tags (L1 l) = tags l
|
||||
tags (R1 r) = tags r
|
||||
@ -222,7 +235,7 @@ instance ToTags Tsx.MemberExpression
|
||||
instance ToTags Tsx.MetaProperty
|
||||
-- instance ToTags Tsx.MethodDefinition
|
||||
instance ToTags Tsx.MethodSignature
|
||||
instance ToTags Tsx.Module
|
||||
-- instance ToTags Tsx.Module
|
||||
instance ToTags Tsx.NamedImports
|
||||
instance ToTags Tsx.NamespaceImport
|
||||
instance ToTags Tsx.NestedIdentifier
|
||||
|
@ -93,6 +93,19 @@ instance ToTags Ts.CallExpression where
|
||||
_ -> gtags t
|
||||
yield name = yieldTag name Call loc byteRange >> gtags t
|
||||
|
||||
instance ToTags Ts.Module where
|
||||
tags t@Ts.Module
|
||||
{ ann = loc@Loc { byteRange }
|
||||
, name
|
||||
} = match name
|
||||
where
|
||||
match expr = case expr of
|
||||
Prj Ts.Identifier { text } -> yield text
|
||||
-- TODO: Handle NestedIdentifiers and Strings
|
||||
-- Prj Tsx.NestedIdentifier { extraChildren } -> match
|
||||
_ -> gtags t
|
||||
yield text = yieldTag text Module loc byteRange >> gtags t
|
||||
|
||||
instance (ToTags l, ToTags r) => ToTags (l :+: r) where
|
||||
tags (L1 l) = tags l
|
||||
tags (R1 r) = tags r
|
||||
@ -215,7 +228,7 @@ instance ToTags Ts.MemberExpression
|
||||
instance ToTags Ts.MetaProperty
|
||||
-- instance ToTags Ts.MethodDefinition
|
||||
instance ToTags Ts.MethodSignature
|
||||
instance ToTags Ts.Module
|
||||
-- instance ToTags Ts.Module
|
||||
instance ToTags Ts.NamedImports
|
||||
instance ToTags Ts.NamespaceImport
|
||||
instance ToTags Ts.NestedIdentifier
|
||||
|
Loading…
Reference in New Issue
Block a user