(decl, desc string)
| 948 | } |
| 949 | |
| 950 | func (j *Importer) scanVar(decl, desc string) (*Var, error) { |
| 951 | v := new(Var) |
| 952 | const eq = " = " |
| 953 | idx := strings.Index(decl, eq) |
| 954 | if idx != -1 { |
| 955 | val, ok := j.parseJavaValue(decl[idx+len(eq):]) |
| 956 | if !ok { |
| 957 | // Skip constants that cannot be represented in Go |
| 958 | return nil, nil |
| 959 | } |
| 960 | v.Val = val |
| 961 | } else { |
| 962 | idx = len(decl) |
| 963 | } |
| 964 | for i := idx - 1; i >= 0; i-- { |
| 965 | if i == 0 || decl[i-1] == ' ' { |
| 966 | v.Name = decl[i:idx] |
| 967 | break |
| 968 | } |
| 969 | } |
| 970 | if v.Name == "" { |
| 971 | return nil, fmt.Errorf("unable to parse member name from declaration: %q", decl) |
| 972 | } |
| 973 | typ, _, err := j.parseJavaType(desc) |
| 974 | if err != nil { |
| 975 | return nil, fmt.Errorf("invalid type signature for %s: %q", v.Name, desc) |
| 976 | } |
| 977 | v.Type = typ |
| 978 | return v, nil |
| 979 | } |
| 980 | |
| 981 | func (j *Importer) scanMethod(decl, desc string, parenIdx int) (*Func, error) { |
| 982 | // Member is a method |
no test coverage detected