aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/src
diff options
context:
space:
mode:
authorBrad Richardson <everythingfunctional@protonmail.com>2020-10-15 10:28:02 -0500
committerBrad Richardson <everythingfunctional@protonmail.com>2020-10-15 10:28:02 -0500
commit84884be16503e506cd5ad7f927297fd7d25de779 (patch)
treec991207d12d4baae29ed13d8048bdc7ae26c3b58 /bootstrap/src
parentc2638957dd9aca90831e0b434fec9ccc05c77acc (diff)
downloadfpm-84884be16503e506cd5ad7f927297fd7d25de779.tar.gz
fpm-84884be16503e506cd5ad7f927297fd7d25de779.zip
Add test for module object file name
Diffstat (limited to 'bootstrap/src')
-rw-r--r--bootstrap/src/BuildModel.hs21
1 files changed, 10 insertions, 11 deletions
diff --git a/bootstrap/src/BuildModel.hs b/bootstrap/src/BuildModel.hs
index 043173f..6446a12 100644
--- a/bootstrap/src/BuildModel.hs
+++ b/bootstrap/src/BuildModel.hs
@@ -44,25 +44,24 @@ data Source =
}
| Module
{ moduleSourceFileName :: FilePath
+ , moduleObjectFileName :: FilePath -> FilePath
}
processRawSource :: RawSource -> Source
processRawSource rawSource =
let sourceFileName = rawSourceFilename rawSource
parsedContents = parseContents rawSource
+ objectFileName =
+ \bd -> bd </> (pathSeparatorsToUnderscores sourceFileName) <.> "o"
in if hasProgramDeclaration parsedContents
- then Program
- { programSourceFileName = sourceFileName
- , programObjectFileName = \buildDirectory ->
- buildDirectory
- </> (pathSeparatorsToUnderscores
- sourceFileName
- )
- <.> "o"
- , programModulesUsed = getModulesUsed parsedContents
- }
+ then Program { programSourceFileName = sourceFileName
+ , programObjectFileName = objectFileName
+ , programModulesUsed = getModulesUsed parsedContents
+ }
else if hasModuleDeclaration parsedContents
- then Module { moduleSourceFileName = sourceFileName }
+ then Module { moduleSourceFileName = sourceFileName
+ , moduleObjectFileName = objectFileName
+ }
else undefined
pathSeparatorsToUnderscores :: FilePath -> FilePath