isPyCompatType checks if type is compatible with python
(typ types.Type)
| 114 | |
| 115 | // isPyCompatType checks if type is compatible with python |
| 116 | func isPyCompatType(typ types.Type) error { |
| 117 | typ = typ.Underlying() |
| 118 | if ptyp, isPtr := typ.(*types.Pointer); isPtr { |
| 119 | if _, isBasic := ptyp.Elem().(*types.Basic); isBasic { |
| 120 | return fmt.Errorf("gopy: type is pointer to basic type") |
| 121 | } |
| 122 | } |
| 123 | if isErrorType(typ) { |
| 124 | return fmt.Errorf("gopy: type is error type") |
| 125 | } |
| 126 | if _, isChan := typ.(*types.Chan); isChan { |
| 127 | return fmt.Errorf("gopy: type is channel type") |
| 128 | } |
| 129 | return nil |
| 130 | } |
| 131 | |
| 132 | // isPyCompatField checks if field is compatible with python |
| 133 | func isPyCompatField(f *types.Var) (*symbol, error) { |
no test coverage detected