Skip to content

Commit

Permalink
The D param appears to be added to the end
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Dec 15, 2023
1 parent ab465f8 commit be88525
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions compiler/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ func collectFunctypes(p *packages.Package, name string, fn ast.Node, scope *func
Names: []*ast.Ident{ast.NewIdent("F")},
},
}
if g != nil {
// Append a field for the dictionary.
fields = append(fields, &ast.Field{
Type: ast.NewIdent("uintptr"),
Names: []*ast.Ident{ast.NewIdent("D")},
})
}
for i, freeVar := range freeVars {
fieldName := ast.NewIdent(fmt.Sprintf("X%d", i))
fieldType := freeVar.typ
Expand All @@ -204,6 +197,13 @@ func collectFunctypes(p *packages.Package, name string, fn ast.Node, scope *func
Names: []*ast.Ident{fieldName},
})
}
if g != nil {
// Append a field for the dictionary.
fields = append(fields, &ast.Field{
Type: ast.NewIdent("uintptr"),
Names: []*ast.Ident{ast.NewIdent("D")},
})
}
functype.closure = &ast.StructType{
Fields: &ast.FieldList{List: fields},
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/testdata/coroutine_durable.go
Original file line number Diff line number Diff line change
Expand Up @@ -3574,12 +3574,12 @@ func init() {
_types.RegisterFunc[func(_fn1 int) (_ func(int))]("github.com/stealthrocket/coroutine/compiler/testdata.(*IdentityGenericStruct[go.shape.int]).Closure")
_types.RegisterClosure[func(_fn0 int), struct {
F uintptr
D uintptr
X0 *struct {
IP int
X0 *IdentityGenericStruct[int]
X1 int
}
D uintptr
}]("github.com/stealthrocket/coroutine/compiler/testdata.(*IdentityGenericStruct[go.shape.int]).Closure.func2")
_types.RegisterFunc[func()]("github.com/stealthrocket/coroutine/compiler/testdata.(*IdentityGenericStruct[go.shape.int]).Run")
_types.RegisterFunc[func(_fn1 int)]("github.com/stealthrocket/coroutine/compiler/testdata.(*MethodGeneratorState).MethodGenerator")
Expand Down Expand Up @@ -3721,8 +3721,8 @@ func init() {
_types.RegisterFunc[func(n int) func()]("github.com/stealthrocket/coroutine/compiler/testdata.buildClosure[go.shape.int]")
_types.RegisterClosure[func(), struct {
F uintptr
D uintptr
X0 int
D uintptr
}]("github.com/stealthrocket/coroutine/compiler/testdata.buildClosure[go.shape.int].func1")
_types.RegisterFunc[func(_fn0 ...int)]("github.com/stealthrocket/coroutine/compiler/testdata.varArgs")
}

0 comments on commit be88525

Please sign in to comment.