From 7abbdcce3ac76d4c60a8191e734087e3b5d27473 Mon Sep 17 00:00:00 2001 From: HEIHUAa <112499486+HEIHUAa@users.noreply.github.com> Date: Wed, 1 Apr 2026 23:56:02 +0800 Subject: [PATCH] exprReturn --- hscript/Interp.hx | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/hscript/Interp.hx b/hscript/Interp.hx index 0cf592e..7373dcc 100644 --- a/hscript/Interp.hx +++ b/hscript/Interp.hx @@ -568,34 +568,33 @@ class Interp { function exprReturn(e):Dynamic { try { - try { - return expr(e); - } catch (e:Stop) { - switch (e) { - case SBreak: - throw "Invalid break"; - case SContinue: - throw "Invalid continue"; - case SReturn: - var v = returnValue; - returnValue = null; - return v; - } - } catch(e) { - if(printCallStack) - error(ECustom('${e.toString()}\n${CallStack.toString(CallStack.exceptionStack(true))}')); - else - error(ECustom(e.toString())); - return null; + return expr(e); + } catch (e:Stop) { + switch (e) { + case SBreak: + throw "Invalid break"; + case SContinue: + throw "Invalid continue"; + case SReturn: + var v = returnValue; + returnValue = null; + return v; } - } catch(e:Error) { - if (errorHandler != null) + } catch (e:Error) { + if (errorHandler != null) { errorHandler(e); - else + } else { throw e; + } + return null; + } catch (e:Dynamic) { + if (printCallStack) { + var stack = CallStack.exceptionStack(true); + error(ECustom(Std.string(e) + "\n" + CallStack.toString(stack))); + } else { + error(ECustom(Std.string(e))); + } return null; - } catch(e) { - trace(e); } return null; }