Browse Source

fixes to allow resuming some completion

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

+ 1 - 1
main.ml

@@ -1191,7 +1191,7 @@ with
 		error ctx (Parser.error_msg m) p
 	| Typecore.Forbid_package ((pack,m,p),pl,pf)  ->
 		if !Common.display_default && ctx.has_next then
-			()
+			ctx.has_error <- false
 		else begin
 			error ctx (Printf.sprintf "You cannot access the %s package while %s (for %s)" pack (if pf = "macro" then "in a macro" else "targeting " ^ pf) (Ast.s_type_path m) ) p;
 			List.iter (error ctx "    referenced here") (List.rev pl);

+ 3 - 1
typeload.ml

@@ -1474,7 +1474,9 @@ let init_class ctx c p context_init herits fields =
 				if c.cl_constructor <> None then error "Duplicate constructor" p;
 				c.cl_constructor <- Some f;
 			end else if not is_static || f.cf_name <> "__init__" then begin
-				if PMap.mem f.cf_name (if is_static then c.cl_statics else c.cl_fields) then error ("Duplicate class field declaration : " ^ f.cf_name) p;
+				if PMap.mem f.cf_name (if is_static then c.cl_statics else c.cl_fields) then
+					display_error ctx ("Duplicate class field declaration : " ^ f.cf_name) p
+				else
 				let dup = if is_static then PMap.exists f.cf_name c.cl_fields || has_field f.cf_name c.cl_super else PMap.exists f.cf_name c.cl_statics in
 				if dup then error ("Same field name can't be use for both static and instance : " ^ f.cf_name) p;
 				if is_static then begin