Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
c0a79cc9
Commit
c0a79cc9
authored
Sep 25, 2015
by
Paul Sokolovsky
Browse files
unix/modjni: Need to really use per-rettype Call*Method functions.
parent
7e18d3b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
unix/modjni.c
View file @
c0a79cc9
...
...
@@ -359,11 +359,22 @@ STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool
JJ
(
ReleaseStringUTFChars
,
name_o
,
decl
);
return
new_jobject
(
res
);
}
else
{
res
=
JJ
(
CallObjectMethodA
,
obj
,
method_id
,
jargs
);
mp_obj_t
ret
=
jvalue2py
(
ret_type
,
res
);
JJ
(
ReleaseStringUTFChars
,
name_o
,
decl
);
if
(
ret
!=
MP_OBJ_NULL
)
{
return
ret
;
if
(
MATCH
(
ret_type
,
"void"
))
{
JJ
(
CallVoidMethodA
,
obj
,
method_id
,
jargs
);
return
mp_const_none
;
}
else
if
(
MATCH
(
ret_type
,
"int"
))
{
jint
res
=
JJ
(
CallIntMethodA
,
obj
,
method_id
,
jargs
);
return
mp_obj_new_int
(
res
);
}
else
if
(
MATCH
(
ret_type
,
"boolean"
))
{
jboolean
res
=
JJ
(
CallBooleanMethodA
,
obj
,
method_id
,
jargs
);
return
mp_obj_new_bool
(
res
);
}
else
if
(
is_object_type
(
ret_type
))
{
res
=
JJ
(
CallObjectMethodA
,
obj
,
method_id
,
jargs
);
mp_obj_t
ret
=
jvalue2py
(
ret_type
,
res
);
JJ
(
ReleaseStringUTFChars
,
name_o
,
decl
);
if
(
ret
!=
MP_OBJ_NULL
)
{
return
ret
;
}
}
nlr_raise
(
mp_obj_new_exception_msg_varg
(
&
mp_type_TypeError
,
"cannot handle return type"
));
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment