| 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 | |
| 7 | package gccgoimporter |
| 8 | |
| 9 | import "go/types" |
| 10 | |
| 11 | func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { |
| 12 | named := make([]*types.Named, len(embeddeds)) |
| 13 | for i, e := range embeddeds { |
| 14 | var ok bool |
| 15 | named[i], ok = e.(*types.Named) |
| 16 | if !ok { |
| 17 | panic("embedding of non-defined interfaces in interfaces is not supported before Go 1.11") |
| 18 | } |
| 19 | } |
| 20 | return types.NewInterface(methods, named) |
| 21 | } |