diff options
| author | aarne <aarne@chalmers.se> | 2011-03-12 11:24:14 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2011-03-12 11:24:14 +0000 |
| commit | 7361ddea45727e80a79ba42af34e45f9641fc993 (patch) | |
| tree | e4f979850e31a630c42be93515dac7aa92a3c542 /src/compiler/GF/Infra | |
| parent | 3ddc29f2dcf57f46c1bd8ff5cc5ebbb910545afd (diff) | |
make it possible to override opers defined in an interface by syntax 'instance Foo of Bar - [f,g,h]'
Diffstat (limited to 'src/compiler/GF/Infra')
| -rw-r--r-- | src/compiler/GF/Infra/Dependencies.hs | 2 | ||||
| -rw-r--r-- | src/compiler/GF/Infra/Modules.hs | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/GF/Infra/Dependencies.hs b/src/compiler/GF/Infra/Dependencies.hs index 82606a865..393d0e8c8 100644 --- a/src/compiler/GF/Infra/Dependencies.hs +++ b/src/compiler/GF/Infra/Dependencies.hs @@ -58,7 +58,7 @@ grammar2moddeps monly gr = [(i,depMod i m) | (i,m) <- modules gr, yes i] modtype = mtype m, ofs = case mtype m of MTConcrete i -> [i | yes i] - MTInstance i -> [i | yes i] + MTInstance (i,_) -> [i | yes i] _ -> [], extendeds = nub $ filter yes $ map fst (extend m), openeds = nub $ filter yes $ map openedModule (opens m), diff --git a/src/compiler/GF/Infra/Modules.hs b/src/compiler/GF/Infra/Modules.hs index af930f881..5175dfdd5 100644 --- a/src/compiler/GF/Infra/Modules.hs +++ b/src/compiler/GF/Infra/Modules.hs @@ -74,7 +74,7 @@ data ModuleType = | MTConcrete Ident -- ^ up to this, also used in GFO. Below, source only. | MTInterface - | MTInstance Ident + | MTInstance (Ident,MInclude) deriving (Eq,Show) data MInclude = MIAll | MIOnly [Ident] | MIExcept [Ident] @@ -145,7 +145,7 @@ depPathModule m = fors m ++ exts m ++ opens m fors m = case mtype m of MTConcrete i -> [OSimple i] - MTInstance i -> [OSimple i] + MTInstance (i,_) -> [OSimple i] _ -> [] exts m = map OSimple (extends m) @@ -189,7 +189,7 @@ allExtendsPlus gr i = Ok m -> i : concatMap (allExtendsPlus gr) (exts m) _ -> [] where - exts m = extends m ++ [j | MTInstance j <- [mtype m]] + exts m = extends m ++ [j | MTInstance (j,_) <- [mtype m]] -- | conversely: all modules that extend a given module, incl. instances of interface allExtensions :: MGrammar a -> Ident -> [Ident] @@ -198,9 +198,11 @@ allExtensions gr i = Ok m -> let es = exts i in es ++ concatMap (allExtensions gr) es _ -> [] where - exts i = [j | (j,m) <- mods, elem i (extends m) - || elem (MTInstance i) [mtype m]] + exts i = [j | (j,m) <- mods, elem i (extends m) || isInstanceOf i m] mods = modules gr + isInstanceOf i m = case mtype m of + MTInstance (j,_) -> j == i + _ -> False -- | initial search path: the nonqualified dependencies searchPathModule :: ModInfo a -> [Ident] |
