Skip to content

Commit b741d73

Browse files
committed
Add support for goose-lang/primitive
Both goose/machine and primitive are supported and mean the same thing for now.
1 parent c68af5c commit b741d73

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

goose.go

+16-6
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,15 @@ func (ctx Ctx) prophIdMethod(f *ast.SelectorExpr, args []ast.Expr) coq.CallExpr
376376
func (ctx Ctx) packageMethod(f *ast.SelectorExpr,
377377
call *ast.CallExpr) coq.Expr {
378378
args := call.Args
379+
// TODO: replace this with an import that has all the right definitions with
380+
// names that match Go
379381
if isIdent(f.X, "filesys") {
380382
return ctx.newCoqCall("FS."+toInitialLower(f.Sel.Name), args)
381383
}
382384
if isIdent(f.X, "disk") {
383385
return ctx.newCoqCall("disk."+f.Sel.Name, args)
384386
}
385-
if isIdent(f.X, "machine") {
387+
if isIdent(f.X, "machine") || isIdent(f.X, "primitive") {
386388
switch f.Sel.Name {
387389
case "UInt64Get", "UInt64Put", "UInt32Get", "UInt32Put":
388390
return ctx.newCoqCall(f.Sel.Name, args)
@@ -2016,22 +2018,30 @@ func stringLitValue(lit *ast.BasicLit) string {
20162018

20172019
// TODO: put this in another file
20182020
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
20192027
"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,
20202030
"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,
20212034
"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,
20242035
"github.com/mit-pdos/gokv/time": true,
20252036
"github.com/mit-pdos/vmvcc/cfmutex": true,
2026-
"sync": true,
2027-
"log": true,
2028-
"fmt": true,
20292037
}
20302038

20312039
var ffiMapping = map[string]string{
20322040
"github.com/mit-pdos/gokv/grove_ffi": "grove",
20332041
"github.com/goose-lang/goose/machine/disk": "disk",
20342042
"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",
20352045
}
20362046

20372047
func (ctx Ctx) imports(d []ast.Spec) []coq.Decl {

0 commit comments

Comments
 (0)