소스 검색

also allow [for(x in it){if(cond)value}] comprehension (some IDE might add {} automatically)

Nicolas Cannasse 12 년 전
부모
커밋
d9aa36046b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      typer.ml

+ 1 - 1
typer.ml

@@ -2049,7 +2049,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 			let p = snd e in
 			(ECall ((EField ((EConst (Ident v.v_name),p),"push"),p),[e]),p)
 		in
-		let efor = type_expr ctx (EFor (it,(match e2 with (EIf (cond,e1,None),p) -> (EIf (cond,push e1,None),p) | _ -> push e2)),fp) NoValue in
+		let efor = type_expr ctx (EFor (it,(match e2 with (EIf (cond,e1,None),p) | (EBlock [(EIf (cond,e1,None),p)],_) -> (EIf (cond,push e1,None),p) | _ -> push e2)),fp) NoValue in
 		mk (TBlock [
 			mk (TVars [v,Some ea]) ctx.t.tvoid p;
 			efor;