Browse Source

do not warn about unused capture-vars if they start with _

Simon Krajewski 12 years ago
parent
commit
9802f09420
1 changed files with 2 additions and 2 deletions
  1. 2 2
      matcher.ml

+ 2 - 2
matcher.ml

@@ -812,7 +812,7 @@ let rec st_to_texpr mctx st = match st.st_def with
 
 
 let replace_locals mctx out e =
 let replace_locals mctx out e =
 	let all_subterms = Hashtbl.create 0 in
 	let all_subterms = Hashtbl.create 0 in
-	let bindings = List.map (fun ((v,p),st) -> Hashtbl.add all_subterms st p; v,st) out.o_bindings in
+	let bindings = List.map (fun ((v,p),st) -> Hashtbl.add all_subterms st (v,p); v,st) out.o_bindings in
 	let replace v =
 	let replace v =
 		let st = List.assq v bindings in
 		let st = List.assq v bindings in
 		Hashtbl.remove all_subterms st;
 		Hashtbl.remove all_subterms st;
@@ -831,7 +831,7 @@ let replace_locals mctx out e =
 	in
 	in
 	let e = loop e in
 	let e = loop e in
 	if not (Common.defined mctx.ctx.com Define.NoUnusedVarWarnings) then
 	if not (Common.defined mctx.ctx.com Define.NoUnusedVarWarnings) then
-		Hashtbl.iter (fun _ p -> mctx.ctx.com.warning "This variable is unused" p) all_subterms;
+		Hashtbl.iter (fun _ (v,p) -> if (String.length v.v_name) > 0 && v.v_name.[0] <> '_' then mctx.ctx.com.warning "This variable is unused" p) all_subterms;
 	e
 	e
 
 
 let rec st_eq st1 st2 = match st1.st_def,st2.st_def with
 let rec st_eq st1 st2 = match st1.st_def,st2.st_def with