github.com/v2fly/tools@v0.100.0/go/internal/gcimporter/newInterface10.go (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !go1.11
     6  // +build !go1.11
     7  
     8  package gcimporter
     9  
    10  import "go/types"
    11  
    12  func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface {
    13  	named := make([]*types.Named, len(embeddeds))
    14  	for i, e := range embeddeds {
    15  		var ok bool
    16  		named[i], ok = e.(*types.Named)
    17  		if !ok {
    18  			panic("embedding of non-defined interfaces in interfaces is not supported before Go 1.11")
    19  		}
    20  	}
    21  	return types.NewInterface(methods, named)
    22  }