Skip to content

Commit

Permalink
all: run v fmt -w . in project root
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Sep 15, 2024
1 parent 1854c16 commit 7294c78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions examples/desktop/v_as_library/libvlang.v
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn jprintln(text string) {
// 2. typeof(text).name
// 3. auto...
// 4. .call_static_method(meth,text)
meth := libvlang.pkg + '.' + jni.v2j_fn_name(@FN) + '(' + typeof(text).name + ')'
meth := pkg + '.' + jni.v2j_fn_name(@FN) + '(' + typeof(text).name + ')'
auto.call_static_method(meth, text)
}

Expand All @@ -107,10 +107,9 @@ fn jprintln(text string) {
*/
// java_float_func is "reflected" from "public static float javaFloatFunc(String s, int i)" in "io.vlang.V"
fn java_float_func(text string, i int) f32 {
return auto.call_static_method(jni.sig(libvlang.pkg, @FN, f32(0), text, i), text,
i).result as f32
return auto.call_static_method(jni.sig(pkg, @FN, f32(0), text, i), text, i).result as f32
}

fn java_void_func(text string, i int) {
auto.call_static_method(jni.sig(libvlang.pkg, @FN, 'void', text, i), text, i)
auto.call_static_method(jni.sig(pkg, @FN, 'void', text, i), text, i)
}
4 changes: 2 additions & 2 deletions jni.v
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,13 @@ pub fn (jo JavaObject) class_name(env &Env) string {
mut cls := get_object_class(env, obj)
// First get the class object
mut mid := get_method_id(env, cls, 'getClass', '()Ljava/lang/Class;')
cls_obj := call_object_method_a(env, obj, mid, jni.void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data'
cls_obj := call_object_method_a(env, obj, mid, void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data'
// Get the class object's class descriptor
cls = get_object_class(env, cls_obj)
// Find the getName() method on the class object
mid = get_method_id(env, cls, 'getName', '()Ljava/lang/String;')
// Call the getName() to get a string struct back
return call_string_method_a(env, cls_obj, mid, jni.void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data'
return call_string_method_a(env, cls_obj, mid, void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data'
}

@[inline]
Expand Down

0 comments on commit 7294c78

Please sign in to comment.