Remove hardcoded default GC from command line options

This commit is contained in:
Kamil Shakirov 2020-06-12 15:11:51 +06:00
parent 7b7415a4e3
commit 90997e9a22
3 changed files with 17 additions and 8 deletions

View File

@ -49,6 +49,12 @@ Eq CG where
Gambit == Gambit = True
_ == _ = False
export
Show CG where
show Chez = "chez"
show Racket = "racket"
show Gambit = "gambit"
export
availableCGs : List (String, CG)
availableCGs
@ -138,13 +144,14 @@ record Options where
extensions : List LangExt
defaultDirs : Dirs
defaultDirs = MkDirs "." Nothing "build"
("build" </> "exec")
defaultDirs = MkDirs "." Nothing "build"
("build" </> "exec")
"/usr/local" ["."] [] []
defaultPPrint : PPrinter
defaultPPrint = MkPPOpts False True False
export
defaultSession : Session
defaultSession = MkSessionOpts False False False Chez 0 False False
Nothing Nothing Nothing Nothing

View File

@ -731,14 +731,14 @@ TTC CDef where
export
TTC CG where
toBuf b Chez = tag 0
toBuf b Racket = tag 2
toBuf b Gambit = tag 3
toBuf b Racket = tag 1
toBuf b Gambit = tag 2
fromBuf b
= case !getTag of
0 => pure Chez
2 => pure Racket
3 => pure Gambit
1 => pure Racket
2 => pure Gambit
_ => corrupt "CG"
export

View File

@ -4,6 +4,8 @@ import IdrisPaths
import Idris.Version
import Core.Options
import Data.List
import Data.Maybe
import Data.Strings
@ -44,7 +46,7 @@ data CLOpt
OutputFile String |
||| Execute a given function after checking the source file
ExecFn String |
||| Use a specific code generator (default chez)
||| Use a specific code generator
SetCG String |
||| Don't implicitly import Prelude
NoPrelude |
@ -113,7 +115,7 @@ options = [MkOpt ["--check", "-c"] [] [CheckOnly]
MkOpt ["--no-prelude"] [] [NoPrelude]
(Just "Don't implicitly import Prelude"),
MkOpt ["--codegen", "--cg"] ["backend"] (\f => [SetCG f])
(Just "Set code generator (default chez)"),
(Just $ "Set code generator (default \""++ show (codegen defaultSession) ++ "\")"),
MkOpt ["--package", "-p"] ["package"] (\f => [PkgPath f])
(Just "Add a package as a dependency"),