浏览代码

prevent catching too many errors (fixed issue #1507)

Nicolas Cannasse 12 年之前
父节点
当前提交
3f27a6c5b9
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      typeload.ml

+ 2 - 2
typeload.ml

@@ -1600,8 +1600,8 @@ let init_class ctx c p context_init herits fields =
 	in
 	let cl_req = check_require c.cl_meta in
 	List.iter (fun f ->
+		let p = f.cff_pos in
 		try
-			let p = f.cff_pos in
 			let fd , constr, f = loop_cf f in
 			let is_static = List.mem AStatic fd.cff_access in
 			if (is_static || constr) && c.cl_interface && f.cf_name <> "__init__" then error "You can't declare static fields in interfaces" p;
@@ -1641,7 +1641,7 @@ let init_class ctx c p context_init herits fields =
 					c.cl_ordered_fields <- f :: c.cl_ordered_fields;
 				end;
 			end
-		with Error (Custom str,p) ->
+		with Error (Custom str,p2) when p = p2 ->
 			display_error ctx str p
 	) fields;
 	(match c.cl_kind with