Bladeren bron

get local vars initialization checks working again (see #4466)

This is only a temp fix.
Simon Krajewski 9 jaren geleden
bovenliggende
commit
35706bdadb

+ 1 - 1
filters.ml

@@ -331,7 +331,7 @@ let check_local_vars_init e =
 		| _ ->
 			Type.iter (loop vars) e
 	in
-	loop (ref PMap.empty) e;
+	loop (ref PMap.empty) (match e.eexpr with TFunction tf -> tf.tf_expr | _ -> e); (* temp fix for #4466 *)
 	e
 
 (* -------------------------------------------------------------------------- *)

+ 6 - 0
tests/misc/projects/Issue4466/Main.hx

@@ -0,0 +1,6 @@
+class Main {
+    static function main() {
+        var a;
+        var b = a + 1;
+    }
+}

+ 2 - 0
tests/misc/projects/Issue4466/compile-fail.hxml

@@ -0,0 +1,2 @@
+-main Main
+--interp

+ 1 - 0
tests/misc/projects/Issue4466/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:4: characters 16-17 : Local variable a used without being initialized