소스 검색

report missing this assignment in abstract constructor (fixed issue #1413)

Simon Krajewski 12 년 전
부모
커밋
9c09805d35
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      codegen.ml

+ 4 - 1
codegen.ml

@@ -1207,7 +1207,10 @@ let check_local_vars_init e =
 		match e.eexpr with
 		| TLocal v ->
 			let init = (try PMap.find v.v_id !vars with Not_found -> true) in
-			if not init then error ("Local variable " ^ v.v_name ^ " used without being initialized") e.epos;
+			if not init then begin
+				if v.v_name = "this" then error "Missing this = value" e.epos
+				else error ("Local variable " ^ v.v_name ^ " used without being initialized") e.epos
+			end
 		| TVars vl ->
 			List.iter (fun (v,eo) ->
 				match eo with