diff options
Diffstat (limited to 'src/Language/Fiddle/Compiler/Qualification.hs')
-rw-r--r-- | src/Language/Fiddle/Compiler/Qualification.hs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/Language/Fiddle/Compiler/Qualification.hs b/src/Language/Fiddle/Compiler/Qualification.hs index 27c0911..eddb3cb 100644 --- a/src/Language/Fiddle/Compiler/Qualification.hs +++ b/src/Language/Fiddle/Compiler/Qualification.hs @@ -10,14 +10,12 @@ -- removed, as they become unnecessary once references are fully qualified. module Language.Fiddle.Compiler.Qualification (qualificationPhase) where -import Control.Monad (forM) import Control.Monad.Identity import Data.Foldable (foldlM) -import Data.Maybe (catMaybes) import Data.Word import Language.Fiddle.Ast import Language.Fiddle.Compiler -import Language.Fiddle.Compiler.ConsistencyCheck +import Language.Fiddle.Compiler.ConsistencyCheck () import Language.Fiddle.Internal.Scopes import Language.Fiddle.Internal.UnitInterface import Language.Fiddle.Types @@ -25,9 +23,9 @@ import Language.Fiddle.Types type CurrentStage = Expanded data GlobalState = GlobalState - { globalScope :: Scope String (Either SizeBits SizeBytes), - fileDependencies :: [FilePath], - unitInterface :: UnitInterface + { _globalScope :: Scope String (Either SizeBits SizeBytes), + _fileDependencies :: [FilePath], + _unitInterface :: UnitInterface } newtype LocalState = LocalState (ScopePath String) @@ -44,8 +42,8 @@ instance CompilationStage Expanded where type StageAfter Expanded = Qualified type StageMonad Expanded = Compile GlobalState type StageState Expanded = LocalState - type StageFunctor Expanded = Identity - type StageAnnotation Expanded = Commented SourceSpan + type StageFunctor Expanded = I + type StageAnnotation Expanded = Annot qualificationPhase :: CompilationPhase Expanded Qualified qualificationPhase = @@ -85,12 +83,12 @@ instance AdvanceStage CurrentStage ObjType where deriving instance (AdvanceStage CurrentStage t) => AdvanceStage CurrentStage (Directed t) instance AdvanceStage CurrentStage PackageBody where - advanceStage localState (PackageBody decls annot) = - PackageBody <$> advanceFiddleDecls localState decls <*> pure annot + advanceStage localState (PackageBody decls a) = + PackageBody <$> advanceFiddleDecls localState decls <*> pure a instance AdvanceStage CurrentStage FiddleUnit where - advanceStage localState (FiddleUnit () decls annot) = - FiddleUnit () <$> advanceFiddleDecls localState decls <*> pure annot + advanceStage localState (FiddleUnit () decls a) = + FiddleUnit () <$> advanceFiddleDecls localState decls <*> pure a advanceFiddleDecls :: LocalState -> @@ -102,6 +100,7 @@ advanceFiddleDecls (LocalState scopePath) decls = fmap (reverse . fst) $ do ( \(declsRet, scopePath') -> \case Directed {directedSubtree = UsingDecl {usingName = name}} -> return (declsRet, addUsingPath (nameToList name) scopePath') + _ -> undefined ) ([], scopePath) decls |