소스 검색

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

Simon Krajewski 11 년 전
부모
커밋
fe714a3f82
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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 {