Browse Source

prevent catching too many errors (fixed issue #1507)

Nicolas Cannasse 12 years ago
parent
commit
3f27a6c5b9
1 changed files with 2 additions and 2 deletions
  1. 2 2
      typeload.ml

+ 2 - 2
typeload.ml

@@ -1600,8 +1600,8 @@ let init_class ctx c p context_init herits fields =
 	in
 	in
 	let cl_req = check_require c.cl_meta in
 	let cl_req = check_require c.cl_meta in
 	List.iter (fun f ->
 	List.iter (fun f ->
+		let p = f.cff_pos in
 		try
 		try
-			let p = f.cff_pos in
 			let fd , constr, f = loop_cf f in
 			let fd , constr, f = loop_cf f in
 			let is_static = List.mem AStatic fd.cff_access 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;
 			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;
 					c.cl_ordered_fields <- f :: c.cl_ordered_fields;
 				end;
 				end;
 			end
 			end
-		with Error (Custom str,p) ->
+		with Error (Custom str,p2) when p = p2 ->
 			display_error ctx str p
 			display_error ctx str p
 	) fields;
 	) fields;
 	(match c.cl_kind with
 	(match c.cl_kind with