cmd/compile/internal/importer: clean up support.go

This commit is contained in:
Lin Lin 2025-04-17 09:09:16 +08:00
parent 3cefe69c5a
commit 89eb0c0fc4
1 changed files with 5 additions and 7 deletions

View File

@ -8,6 +8,7 @@ package importer
import (
"cmd/compile/internal/base"
"cmd/compile/internal/types"
"cmd/compile/internal/types2"
"fmt"
"go/token"
@ -23,8 +24,6 @@ func errorf(format string, args ...interface{}) {
panic(fmt.Sprintf(format, args...))
}
const deltaNewFile = -64 // see cmd/compile/internal/gc/bexport.go
// Synthesize a token.Pos
type fakeFileSet struct {
fset *token.FileSet
@ -67,13 +66,12 @@ var (
)
func chanDir(d int) types2.ChanDir {
// tag values must match the constants in cmd/compile/internal/gc/go.go
switch d {
case 1 /* Crecv */ :
switch types.ChanDir(d) {
case types.Crecv:
return types2.RecvOnly
case 2 /* Csend */ :
case types.Csend:
return types2.SendOnly
case 3 /* Cboth */ :
case types.Cboth:
return types2.SendRecv
default:
errorf("unexpected channel dir %d", d)