From f80266618c2c09c32f83289e4f265701edfa15bc Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Fri, 27 Dec 2024 19:09:01 +0200 Subject: [PATCH] fix: throw copied return syntax too closely --- .../jscript/compilation/control/ThrowNode.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/topchetoeu/jscript/compilation/control/ThrowNode.java b/src/main/java/me/topchetoeu/jscript/compilation/control/ThrowNode.java index 87dcce2..3c6459f 100644 --- a/src/main/java/me/topchetoeu/jscript/compilation/control/ThrowNode.java +++ b/src/main/java/me/topchetoeu/jscript/compilation/control/ThrowNode.java @@ -32,17 +32,11 @@ public class ThrowNode extends Node { if (!Parsing.isIdentifier(src, i + n, "throw")) return ParseRes.failed(); n += 5; - var end = JavaScript.parseStatementEnd(src, i + n); - if (end.isSuccess()) { - n += end.n; - return ParseRes.res(new ThrowNode(loc, null), n); - } - var val = JavaScript.parseExpression(src, i + n, 0); - if (val.isFailed()) return ParseRes.error(src.loc(i + n), "Expected a value"); + if (val.isFailed()) return ParseRes.error(src.loc(i + n), "Expected a throw value"); n += val.n; - end = JavaScript.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new ThrowNode(loc, val.result), n);