2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / libgo / runtime / reflect.goc
blob4e493ee810a1ebced4023b58bd9bf67155a8910e
1 // Copyright 2010 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.
5 package reflect
6 #include "runtime.h"
7 #include "go-type.h"
8 #include "interface.h"
9 #include "go-panic.h"
11 func ifaceE2I(inter *Type, e Eface, ret *Iface) {
12         const Type *t;
13         Eface err;
15         t = e.__type_descriptor;
16         if(t == nil) {
17                 // explicit conversions require non-nil interface value.
18                 runtime_newTypeAssertionError(
19                         nil, nil, inter->__reflection,
20                         nil, &err);
21                 runtime_panic(err);
22         }
23         ret->__object = e.__object;
24         ret->__methods = __go_convert_interface(inter, t);