@@ -376,13 +376,15 @@ func (ctx Ctx) prophIdMethod(f *ast.SelectorExpr, args []ast.Expr) coq.CallExpr
376
376
func (ctx Ctx ) packageMethod (f * ast.SelectorExpr ,
377
377
call * ast.CallExpr ) coq.Expr {
378
378
args := call .Args
379
+ // TODO: replace this with an import that has all the right definitions with
380
+ // names that match Go
379
381
if isIdent (f .X , "filesys" ) {
380
382
return ctx .newCoqCall ("FS." + toInitialLower (f .Sel .Name ), args )
381
383
}
382
384
if isIdent (f .X , "disk" ) {
383
385
return ctx .newCoqCall ("disk." + f .Sel .Name , args )
384
386
}
385
- if isIdent (f .X , "machine" ) {
387
+ if isIdent (f .X , "machine" ) || isIdent ( f . X , "primitive" ) {
386
388
switch f .Sel .Name {
387
389
case "UInt64Get" , "UInt64Put" , "UInt32Get" , "UInt32Put" :
388
390
return ctx .newCoqCall (f .Sel .Name , args )
@@ -2016,22 +2018,30 @@ func stringLitValue(lit *ast.BasicLit) string {
2016
2018
2017
2019
// TODO: put this in another file
2018
2020
var builtinImports = map [string ]bool {
2021
+ "fmt" : true ,
2022
+ "log" : true ,
2023
+ "sync" : true ,
2024
+
2025
+ // TODO: minimize this list by instead adding trusted imports with the right
2026
+ // paths
2019
2027
"github.com/goose-lang/goose/machine" : true ,
2028
+ "github.com/goose-lang/goose/machine/async_disk" : true ,
2029
+ "github.com/goose-lang/goose/machine/disk" : true ,
2020
2030
"github.com/goose-lang/goose/machine/filesys" : true ,
2031
+ "github.com/goose-lang/primitive" : true ,
2032
+ "github.com/goose-lang/primitive/async_disk" : true ,
2033
+ "github.com/goose-lang/primitive/disk" : true ,
2021
2034
"github.com/mit-pdos/gokv/grove_ffi" : true ,
2022
- "github.com/goose-lang/goose/machine/disk" : true ,
2023
- "github.com/goose-lang/goose/machine/async_disk" : true ,
2024
2035
"github.com/mit-pdos/gokv/time" : true ,
2025
2036
"github.com/mit-pdos/vmvcc/cfmutex" : true ,
2026
- "sync" : true ,
2027
- "log" : true ,
2028
- "fmt" : true ,
2029
2037
}
2030
2038
2031
2039
var ffiMapping = map [string ]string {
2032
2040
"github.com/mit-pdos/gokv/grove_ffi" : "grove" ,
2033
2041
"github.com/goose-lang/goose/machine/disk" : "disk" ,
2034
2042
"github.com/goose-lang/goose/machine/async_disk" : "async_disk" ,
2043
+ "github.com/goose-lang/primitive/disk" : "disk" ,
2044
+ "github.com/goose-lang/primitive/async_disk" : "async_disk" ,
2035
2045
}
2036
2046
2037
2047
func (ctx Ctx ) imports (d []ast.Spec ) []coq.Decl {
0 commit comments