fix: throw copied return syntax too closely

This commit is contained in:
TopchetoEU 2024-12-27 19:09:01 +02:00
parent f1997e4584
commit f80266618c
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -32,17 +32,11 @@ public class ThrowNode extends Node {
if (!Parsing.isIdentifier(src, i + n, "throw")) return ParseRes.failed(); if (!Parsing.isIdentifier(src, i + n, "throw")) return ParseRes.failed();
n += 5; 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); 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; n += val.n;
end = JavaScript.parseStatementEnd(src, i + n); var end = JavaScript.parseStatementEnd(src, i + n);
if (end.isSuccess()) { if (end.isSuccess()) {
n += end.n; n += end.n;
return ParseRes.res(new ThrowNode(loc, val.result), n); return ParseRes.res(new ThrowNode(loc, val.result), n);