Procházet zdrojové kódy

run handle_abstract_casts filter in one batch;
and then apply the rest of filters in another batch
(fixes #7642)

Aleksandr Kuzmenko před 6 roky
rodič
revize
6d7aa4a52c
2 změnil soubory, kde provedl 25 přidání a 0 odebrání
  1. 5 0
      src/filters/filters.ml
  2. 20 0
      tests/unit/src/unit/issues/Issue7642.hx

+ 5 - 0
src/filters/filters.ml

@@ -795,6 +795,11 @@ let run com tctx main =
 		(* ForRemap.apply tctx; *)
 		VarLazifier.apply com;
 		AbstractCast.handle_abstract_casts tctx;
+	] in
+	let t = filter_timer detail_times ["expr 0"] in
+	List.iter (run_expression_filters tctx filters) new_types;
+	t();
+	let filters = [
 		check_local_vars_init;
 		if Common.defined com Define.OldConstructorInline then Optimizer.inline_constructors tctx else InlineConstructors.inline_constructors tctx;
 		Optimizer.reduce_expression tctx;

+ 20 - 0
tests/unit/src/unit/issues/Issue7642.hx

@@ -0,0 +1,20 @@
+package unit.issues;
+
+import utest.Assert;
+
+class Issue7642 extends unit.Test {
+	@:analyzer(ignore)
+	function test() {
+		apply();
+		noAssert();
+	}
+
+	@:analyzer(ignore)
+	static public inline function apply(n = 0):Void {
+		new Map<Int, Int>();
+		//avoid infinite recursion
+		if(n < 3) {
+			apply(++n);
+		}
+	}
+}