@@ -108,7 +108,7 @@ data MakeActions m = MakeActions
108108 , readExterns :: ModuleName -> m (FilePath , Externs )
109109 -- ^ Read the externs file for a module as a string and also return the actual
110110 -- path for the file.
111- , codegen :: CF. Module CF. Ann -> Environment -> Externs -> SupplyT m ()
111+ , codegen :: SourceSpan -> CF. Module CF. Ann -> Environment -> Externs -> SupplyT m ()
112112 -- ^ Run the code generator for the module and write any required output files.
113113 , progress :: ProgressMessage -> m ()
114114 -- ^ Respond to a progress update.
@@ -154,7 +154,7 @@ rebuildModule MakeActions{..} externs m@(Module _ _ moduleName _ _) = do
154154 corefn = CF. moduleToCoreFn env' mod'
155155 [renamed] = renameInModules [corefn]
156156 exts = moduleToExternsFile mod' env'
157- evalSupplyT nextVar' . codegen renamed env' . encode $ exts
157+ evalSupplyT nextVar' . codegen ss renamed env' . encode $ exts
158158 return exts
159159
160160-- | Compiles in "make" mode, compiling each module separately to a @.js@ file and an @externs.json@ file.
@@ -344,16 +344,16 @@ buildMakeActions outputDir filePathMap foreigns usePrefix =
344344 let path = outputDir </> T. unpack (runModuleName mn) </> " externs.json"
345345 (path, ) <$> readTextFile path
346346
347- codegen :: CF. Module CF. Ann -> Environment -> Externs -> SupplyT Make ()
348- codegen m _ exts = do
347+ codegen :: SourceSpan -> CF. Module CF. Ann -> Environment -> Externs -> SupplyT Make ()
348+ codegen modSS m _ exts = do
349349 let mn = CF. moduleName m
350350 foreignInclude <- case mn `M.lookup` foreigns of
351351 Just path
352352 | not $ requiresForeign m -> do
353- tell $ errorMessage $ UnnecessaryFFIModule mn path
353+ tell $ errorMessage' modSS $ UnnecessaryFFIModule mn path
354354 return Nothing
355355 | otherwise -> do
356- checkForeignDecls m path
356+ checkForeignDecls modSS m path
357357 return $ Just $ Imp. App Nothing (Imp. Var Nothing " require" ) [Imp. StringLiteral Nothing " ./foreign" ]
358358 Nothing | requiresForeign m -> throwError . errorMessage $ MissingFFIModule mn
359359 | otherwise -> return Nothing
@@ -425,8 +425,8 @@ buildMakeActions outputDir filePathMap foreigns usePrefix =
425425
426426-- | Check that the declarations in a given PureScript module match with those
427427-- in its corresponding foreign module.
428- checkForeignDecls :: CF. Module ann -> FilePath -> SupplyT Make ()
429- checkForeignDecls m path = do
428+ checkForeignDecls :: SourceSpan -> CF. Module ann -> FilePath -> SupplyT Make ()
429+ checkForeignDecls modSS m path = do
430430 jsStr <- lift $ readTextFile path
431431 js <- either (errorParsingModule . Bundle. UnableToParseModule ) pure $ JS. parse (BU8. toString (B. toStrict jsStr)) path
432432
@@ -439,12 +439,12 @@ checkForeignDecls m path = do
439439
440440 let unusedFFI = foreignIdents S. \\ importedIdents
441441 unless (null unusedFFI) $
442- tell . errorMessage . UnusedFFIImplementations mname $
442+ tell . errorMessage' modSS . UnusedFFIImplementations mname $
443443 S. toList unusedFFI
444444
445445 let missingFFI = importedIdents S. \\ foreignIdents
446446 unless (null missingFFI) $
447- throwError . errorMessage . MissingFFIImplementations mname $
447+ throwError . errorMessage' modSS . MissingFFIImplementations mname $
448448 S. toList missingFFI
449449
450450 where
0 commit comments