lookUpDBSymbol :: TypeNode -> [[String]] -> SemanticUnit -> [String] -> [Symbol]
lookUpDBSymbol db imps su cname
    | or $ map (\(pre, post) -> traverseTypeEntryWithImports db imps pre /= []) ps'' = [] -- prefix of a type is resolved to a type
    | length tps' > 0 = tps'
    | otherwise = (map symbol $ nub tps)
        where
            baseName = (typeToName . lookUpThis) su
            ps = map (\i -> (take i cname, drop i cname)) [1..(length cname)]
            ps' = reverse $ takeWhile (\(pre, post) -> traverseTypeEntryWithImports db imps pre == []) (reverse ps)
            ps'' = reverse $ drop 1 $ dropWhile (\(pre, post) -> traverseTypeEntryWithImports db imps pre == []) (reverse ps)
            tps = concat $ map (\(pre, post) -> concat $ map (\tn -> traverseInstanceEntryAccessible db baseName tn post) (traverseFieldEntryWithImports db imps pre)) ps'
            tps' = map (\nm -> symbol $ fromJust $ getTypeEntry db nm) (lookUpType db imps cname)

------------------------------------------------------------------------------------
lookUpDBSymbol :: TypeNode -> [[String]] -> SemanticUnit -> [String] -> [Symbol]
lookUpDBSymbol db imps su cname
    | or $ map (\(pre, post) -> traverseTypeEntryWithImports db imps pre /= []) ps'' = [] -- prefix of a type is resolved to a type
    | length tps' > 0 = tps'
    | otherwise = (map symbol $ nub tps)
        where
            baseName = (typeToName . lookUpThis) su
            ps = map (\i -> (take i cname, drop i cname)) [1..(length cname)]
            ps' = reverse $ takeWhile (\(pre, post) -> traverseTypeEntryWithImports db imps pre == []) (reverse ps)
            ps'' = reverse $ drop 1 $ dropWhile (\(pre, post) -> traverseTypeEntryWithImports db imps pre == []) (reverse ps)
            tps = concat $ map (\(pre, post) -> concat $ map (\tn -> traverseInstanceEntryAccessible db baseName tn post) (traverseFieldEntryWithImports db imps pre)) ps'
            tps' = map (\nm -> symbol $ fromJust $ getTypeEntry db nm) (lookUpType db imps cname)

------------------------------------------------------------------------------------
lookUpDBSymbol db imps su cname
    | or $ map (\(pre, post) -> traverseTypeEntryWithImports db imps pre /= []) ps'' = [] -- prefix of a type is resolved to a type
    | length tps' > 0 = tps'
    | otherwise = (map symbol $ nub tps)
        where
            baseName = (typeToName . lookUpThis) su
            ps = map (\i -> (take i cname, drop i cname)) [1..(length cname)]
            ps' = reverse $ takeWhile (\(pre, post) -> traverseTypeEntryWithImports db imps pre == []) (reverse ps)
            ps'' = reverse $ drop 1 $ dropWhile (\(pre, post) -> traverseTypeEntryWithImports db imps pre == []) (reverse ps)
            tps = concat $ map (\(pre, post) -> concat $ map (\tn -> traverseInstanceEntryAccessible db baseName tn post) (traverseFieldEntryWithImports db imps pre)) ps'
            tps' = map (\nm -> symbol $ fromJust $ getTypeEntry db nm) (lookUpType db imps cname)

------------------------------------------------------------------------------------