2
0
Эх сурвалжийг харах

[php7] Save stack of a caught exception only if CallStack.exceptionStack() is used somewhere (fixes #6046)

Alexander Kuzmenko 8 жил өмнө
parent
commit
2b619a7173

+ 1 - 1
src/generators/genphp7.ml

@@ -2113,7 +2113,7 @@ class virtual type_builder ctx wrapper =
 			self#write_as_block try_expr;
 			self#write " catch (\\Throwable $__hx__caught_e) {\n";
 			self#indent_more;
-			if ctx.debug then
+			if has_feature ctx "haxe.CallStack.exceptionStack"  then
 				self#write_statement ((self#use (["haxe"], "CallStack")) ^ "::saveExceptionTrace($__hx__caught_e)");
 			self#write_statement ("$__hx__real_e = ($__hx__caught_e instanceof " ^ haxe_exception ^ " ? $__hx__caught_e->e : $__hx__caught_e)");
 			self#write_indentation;

+ 2 - 3
std/php7/_std/haxe/CallStack.hx

@@ -15,9 +15,8 @@ enum StackItem {
 	LocalFunction( ?v : Int );
 }
 
-@:dox(hide)
-@:noCompletion
 class CallStack {
+	@:ifFeature("haxe.CallStack.exceptionStack")
 	static var lastExceptionTrace : NativeTrace;
 
 	/**
@@ -73,7 +72,7 @@ class CallStack {
 		}
 	}
 
-	@:keep
+	@:ifFeature("haxe.CallStack.exceptionStack")
 	static function saveExceptionTrace( e:Throwable ) : Void {
 		lastExceptionTrace = e.getTrace();