1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 20:31:55 +03:00

Conditionally match against Indexed nodes when applying toTermName for Import Syntax

This commit is contained in:
Rick Winfrey 2016-10-17 11:01:45 -05:00
parent dfc11385d8
commit 36eb60d05d

View File

@ -219,7 +219,9 @@ toTermName source term = case unwrap term of
S.Commented _ _ -> termNameFromChildren term (toList $ unwrap term)
S.Module identifier _ -> toTermName' identifier
S.Import identifier [] -> toTermName' identifier
S.Import identifier expr -> intercalate ", " (termNameFromSource <$> expr) <> " from " <> toTermName' identifier
S.Import identifier exprs'@(expr:exprs)-> case unwrap expr of
S.Indexed _ -> intercalate ", " (termNameFromSource <$> exprs) <> "from " <> toTermName' identifier
_ -> intercalate ", " (termNameFromSource <$> exprs') <> "from " <> toTermName' identifier
S.Export Nothing expr -> "{ " <> intercalate ", " (termNameFromSource <$> expr) <> " }"
S.Export (Just identifier) [] -> "{ " <> toTermName' identifier <> " }"
S.Export (Just identifier) expr -> "{ " <> intercalate ", " (termNameFromSource <$> expr) <> " }" <> " from " <> toTermName' identifier