diff options
| author | aarne <unknown> | 2003-11-05 14:42:29 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2003-11-05 14:42:29 +0000 |
| commit | 49c17be41a7d572d27df74eb7351b672e85953a1 (patch) | |
| tree | 2856b2b2af3c3d6adea285dcb42173b920751897 /src/GF/Infra/Modules.hs | |
| parent | ed1d2a2954a3c955625cf210905a67e0683c8411 (diff) | |
working with interfaces
Diffstat (limited to 'src/GF/Infra/Modules.hs')
| -rw-r--r-- | src/GF/Infra/Modules.hs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/GF/Infra/Modules.hs b/src/GF/Infra/Modules.hs index 5d2e0fd15..569806e60 100644 --- a/src/GF/Infra/Modules.hs +++ b/src/GF/Infra/Modules.hs @@ -133,6 +133,16 @@ allExtendsPlus gr i = case lookupModule gr i of where exts m = [j | Just j <- [extends m]] ++ [j | MTInstance j <- [mtype m]] +-- conversely: all modules that extend a given module, incl. instances of interface +allExtensions :: (Show i,Ord i) => MGrammar i f a -> i -> [i] +allExtensions gr i = case lookupModule gr i of + Ok (ModMod m) -> let es = exts i in es ++ concatMap (allExtensions gr) es + _ -> [] + where + exts i = [j | (j,m) <- mods, elem (Just i) [extends m] + || elem (MTInstance i) [mtype m]] + mods = [(j,m) | (j,ModMod m) <- modules gr] + -- initial search path: the nonqualified dependencies searchPathModule :: Ord i => Module i f a -> [i] searchPathModule m = [i | OSimple _ i <- depPathModule m] @@ -160,7 +170,7 @@ typeOfModule mi = case mi of isResourceModule mi = case typeOfModule mi of MTResource -> True MTReuse _ -> True ---- MTInterface -> True + MTInterface -> True --- MTInstance _ -> True _ -> False @@ -207,6 +217,7 @@ isModAbs m = case mtype m of isModRes m = case mtype m of MTResource -> True + MTInstance _ -> True _ -> False isModCnc m = case mtype m of @@ -219,6 +230,12 @@ isModTrans m = case mtype m of sameMType m n = case (m,n) of (MTConcrete _, MTConcrete _) -> True + (MTInstance _, MTInstance _) -> True + (MTInstance _, MTResource) -> True + (MTInstance _, MTInterface) -> True + (MTResource, MTInstance _) -> True + (MTResource, MTInterface) -> True + (MTInterface,MTResource) -> True _ -> m == n -- don't generate code for interfaces and for incomplete modules @@ -227,4 +244,3 @@ isCompilableModule m = case m of MTInterface -> False _ -> mstatus m == MSComplete _ -> False --- - |
