diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-10-03 11:13:13 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-10-03 11:13:13 -0600 |
commit | 3fc6bee1a1359a68b77a6f11ed70bdcb88027da2 (patch) | |
tree | 11c38f121b66aaef8e89666d74f35f59253e1770 /src/Language/Fiddle/Compiler | |
parent | fa32199f5ffc6405bd405e055051e11e85c80668 (diff) | |
download | fiddle-3fc6bee1a1359a68b77a6f11ed70bdcb88027da2.tar.gz fiddle-3fc6bee1a1359a68b77a6f11ed70bdcb88027da2.tar.bz2 fiddle-3fc6bee1a1359a68b77a6f11ed70bdcb88027da2.zip |
Change the UnitInterface to have uncoupled Metadata.
As opposed to the original 'Annotated' data type.
Diffstat (limited to 'src/Language/Fiddle/Compiler')
-rw-r--r-- | src/Language/Fiddle/Compiler/ConsistencyCheck.hs | 9 | ||||
-rw-r--r-- | src/Language/Fiddle/Compiler/ImportResolution.hs | 8 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/Language/Fiddle/Compiler/ConsistencyCheck.hs b/src/Language/Fiddle/Compiler/ConsistencyCheck.hs index abfbb9b..e081122 100644 --- a/src/Language/Fiddle/Compiler/ConsistencyCheck.hs +++ b/src/Language/Fiddle/Compiler/ConsistencyCheck.hs @@ -142,7 +142,7 @@ instance AdvanceStage Expanded ImportStatement where where unitInterfaceScopeToGlobalScope = fmap - ( \(Annotated _ _ exportedValue) -> case exportedValue of + ( \(_, exportedValue) -> case exportedValue of ExportedBitsType sz -> Left sz ExportedObjType sz -> Right sz ) @@ -597,7 +597,12 @@ insertIntoUnitInterface path ui (Commented comments srcspan) val = ) in ui { rootScope = - insertScope path (Annotated srcspan docComments val) (rootScope ui) + insertScope + path + ( Metadata srcspan docComments [], + val + ) + (rootScope ui) } insertTypeSize :: diff --git a/src/Language/Fiddle/Compiler/ImportResolution.hs b/src/Language/Fiddle/Compiler/ImportResolution.hs index 4f076b8..aacf27e 100644 --- a/src/Language/Fiddle/Compiler/ImportResolution.hs +++ b/src/Language/Fiddle/Compiler/ImportResolution.hs @@ -218,8 +218,9 @@ getImportResolutionState parseFile compileToChecked flags unit = do then doFullCompile else return val Left err -> do - tell [Diagnostic Error err srcSpan] - MaybeT $ return Nothing + tell [Diagnostic Warning "Doing recompile" srcSpan] + tell [Diagnostic Warning err srcSpan] + doFullCompile else doFullCompile addDependency path unitInterface = @@ -254,7 +255,8 @@ getImportResolutionState parseFile compileToChecked flags unit = do findFileInImportPath :: SourceSpan -> [FilePath] -> FilePath -> Compl FilePath findFileInImportPath sourceSpan paths path = do - realPaths <- lift2 $ filterM doesFileExist (map (++ ("/" ++ path)) paths) + canonicalPaths <- lift2 $ mapM (canonicalizePath . (++ ("/" ++ path))) paths + realPaths <- lift2 $ filterM doesFileExist canonicalPaths case realPaths of [] -> do |