From be334515639f20fd928b5b6ff0ae7cab1dba6bd7 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Fri, 26 Jan 2018 13:55:44 -0800 Subject: [PATCH] Special Ruby handling for now --- src/Analysis/Declaration.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Analysis/Declaration.hs b/src/Analysis/Declaration.hs index efc4b14e3..004c4aba5 100644 --- a/src/Analysis/Declaration.hs +++ b/src/Analysis/Declaration.hs @@ -130,11 +130,12 @@ instance CustomHasDeclaration whole Declaration.Class where instance (Declaration.ImportSymbol :< fs) => CustomHasDeclaration (Union fs) Declaration.Import where customToDeclaration Blob{..} _ (Declaration.Import (Term (In fromAnn _), _) (Term (In aliasAnn _), _) symbols) - = Just $ ImportDeclaration name (getAlias (getSource aliasAnn)) (mapMaybe getSymbol symbols) blobLanguage + = Just $ ImportDeclaration name (getAlias blobLanguage (getSource aliasAnn)) (mapMaybe getSymbol symbols) blobLanguage where name = getSource fromAnn - getAlias alias | T.null alias = basename name - | otherwise = alias + getAlias lang alias | Just Ruby <- lang, T.null alias = alias + | T.null alias = basename name + | otherwise = alias basename = last . T.splitOn "/" getSource = T.dropAround (`elem` ['"', '\'']) . toText . flip Source.slice blobSource . getField getSymbol (Term (In _ f), _) | Just (Declaration.ImportSymbol (Term (In nameAnn _)) (Term (In aliasAnn _))) <- prj f