isPyCompatField checks if field is compatible with python
(f *types.Var)
| 131 | |
| 132 | // isPyCompatField checks if field is compatible with python |
| 133 | func isPyCompatField(f *types.Var) (*symbol, error) { |
| 134 | if !f.Exported() || f.Embedded() { |
| 135 | return nil, fmt.Errorf("gopy: field not exported or is embedded") |
| 136 | } |
| 137 | ftyp := current.symtype(f.Type()) |
| 138 | if _, isSig := f.Type().Underlying().(*types.Signature); isSig { |
| 139 | return nil, fmt.Errorf("gopy: type is function signature") |
| 140 | } |
| 141 | if f.Type().Underlying().String() == "interface{}" { |
| 142 | return nil, fmt.Errorf("gopy: type is interface{}") |
| 143 | } |
| 144 | return ftyp, isPyCompatVar(ftyp) |
| 145 | } |
| 146 | |
| 147 | // isPyCompatFunc checks if function signature is a python-compatible function. |
| 148 | // Returns nil if function is compatible, err message if not. |
no test coverage detected