cgo: add file AST for fake C file locations

This is needed for the type checker, otherwise it doesn't know which Go
version it should use for type checking.
This commit is contained in:
Ayke van Laethem
2024-01-17 15:55:07 +01:00
parent 0ad15551c8
commit 53db436a7d
5 changed files with 38 additions and 6 deletions
+17
View File
@@ -0,0 +1,17 @@
//go:build go1.22
package cgo
// Code specifically for Go 1.22.
import (
"go/ast"
"go/token"
)
func init() {
setASTFileFields = func(f *ast.File, start, end token.Pos) {
f.FileStart = start
f.FileEnd = end
}
}