OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [go-check-interface.c] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
/* go-check-interface.c -- check an interface type for a conversion
2
 
3
   Copyright 2010 The Go Authors. All rights reserved.
4
   Use of this source code is governed by a BSD-style
5
   license that can be found in the LICENSE file.  */
6
 
7
#include "go-panic.h"
8
#include "interface.h"
9
 
10
/* Check that an interface type matches for a conversion to a
11
   non-interface type.  This panics if the types are bad.  The actual
12
   extraction of the object is inlined.  */
13
 
14
void
15
__go_check_interface_type (
16
    const struct __go_type_descriptor *lhs_descriptor,
17
    const struct __go_type_descriptor *rhs_descriptor,
18
    const struct __go_type_descriptor *rhs_inter_descriptor)
19
{
20
  if (rhs_descriptor == NULL)
21
    {
22
      struct __go_empty_interface panic_arg;
23
 
24
      newTypeAssertionError(NULL, NULL, lhs_descriptor, NULL, NULL,
25
                            lhs_descriptor->__reflection, NULL, &panic_arg);
26
      __go_panic(panic_arg);
27
    }
28
 
29
  if (lhs_descriptor != rhs_descriptor
30
      && !__go_type_descriptors_equal (lhs_descriptor, rhs_descriptor)
31
      && (lhs_descriptor->__code != GO_UNSAFE_POINTER
32
          || !__go_is_pointer_type (rhs_descriptor))
33
      && (rhs_descriptor->__code != GO_UNSAFE_POINTER
34
          || !__go_is_pointer_type (lhs_descriptor)))
35
    {
36
      struct __go_empty_interface panic_arg;
37
 
38
      newTypeAssertionError(rhs_inter_descriptor, rhs_descriptor,
39
                            lhs_descriptor,
40
                            rhs_inter_descriptor->__reflection,
41
                            rhs_descriptor->__reflection,
42
                            lhs_descriptor->__reflection,
43
                            NULL, &panic_arg);
44
      __go_panic(panic_arg);
45
    }
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.