genCRetClear clears the result value from a JNI call if an exception was raised.
(varName string, t types.Type, exc string)
| 876 | // genCRetClear clears the result value from a JNI call if an exception was |
| 877 | // raised. |
| 878 | func (g *JavaGen) genCRetClear(varName string, t types.Type, exc string) { |
| 879 | g.Printf("if (%s != NULL) {\n", exc) |
| 880 | g.Indent() |
| 881 | switch t := t.(type) { |
| 882 | case *types.Basic: |
| 883 | switch t.Kind() { |
| 884 | case types.String: |
| 885 | g.Printf("%s = NULL;\n", varName) |
| 886 | default: |
| 887 | g.Printf("%s = 0;\n", varName) |
| 888 | } |
| 889 | case *types.Slice, *types.Named, *types.Pointer: |
| 890 | g.Printf("%s = NULL;\n", varName) |
| 891 | } |
| 892 | g.Outdent() |
| 893 | g.Printf("}\n") |
| 894 | } |
| 895 | |
| 896 | func (g *JavaGen) genJavaToC(varName string, t types.Type, mode varMode) { |
| 897 | switch t := types.Unalias(t).(type) { |
no test coverage detected