Parcourir la source

[jvm] fix calling functions with rest args
without providing any values for rest args (#9961)

Aleksandr Kuzmenko il y a 4 ans
Parent
commit
756fc58564
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      src/generators/genjvm.ml

+ 7 - 0
src/generators/genjvm.ml

@@ -1409,6 +1409,13 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 					in
 					loop acc tl el
 				end
+			| [(_,_,t)],[] ->
+				(match Type.follow t with
+				| TAbstract({a_path = ["haxe"],"Rest"},[t1]) ->
+					let jsig = jsignature_of_type gctx t in
+					self#new_native_array (get_boxed_type (jsignature_of_type gctx t1)) [];
+					List.rev (jsig :: acc)
+				| _ -> List.rev acc)
 			| _,[] -> List.rev acc
 			| [],e :: el ->
 				(* TODO: this sucks *)