Browse Source

generate variable name if static extension argument has no name (closes #2495)

Simon Krajewski 11 years ago
parent
commit
fe714a3f82
1 changed files with 2 additions and 1 deletions
  1. 2 1
      typer.ml

+ 2 - 1
typer.ml

@@ -766,7 +766,8 @@ let rec acc_get ctx g p =
 		| TFun (_ :: args,ret) ->
 			let tcallb = TFun (args,ret) in
 			let twrap = TFun ([("_e",false,e.etype)],tcallb) in
-			let args = List.map (fun (n,_,t) -> alloc_var n t) args in
+			(* arguments might not have names in case of variable fields of function types, so we generate one (issue #2495) *)
+			let args = List.map (fun (n,_,t) -> if n = "" then gen_local ctx t else alloc_var n t) args in
 			let ve = alloc_var "_e" e.etype in
 			let ecall = make_call ctx et (List.map (fun v -> mk (TLocal v) v.v_type p) (ve :: args)) ret p in
 			let ecallb = mk (TFunction {