fix subLiterals unknown and the test
All checks were successful
/ test (push) Successful in 1m4s
/ deploy (push) Successful in 1m15s

two stupid bugs...
This commit is contained in:
kento2 2026-08-29 16:20:22 +02:00
parent 77ea59cc92
commit 546be9db36
6 changed files with 32 additions and 41 deletions

View file

@ -26,7 +26,6 @@ public class NodeTreeWalker<C extends CommandContext<C>> {
) {
var cursor = new Cursor(iter);
Literal<C> literal = rootLiteral;
String token;
while (true) {
for (var arg : literal.arguments()) {
@ -36,14 +35,12 @@ public class NodeTreeWalker<C extends CommandContext<C>> {
return res;
}
token = cursor.nextToken();
if (token == null)
var literalName = cursor.nextToken();
if (literalName == null)
break;
var nextLiteral = literal.getSubLiteral(token);
if (nextLiteral == null)
return new WalkResult.LiteralUnknown<>(ctx, literal, token);
if (platformAdapter.checkPermission(ctx, nextLiteral.permission()))
return new WalkResult.LiteralUnknown<>(ctx, literal, token);
var nextLiteral = literal.getSubLiteral(literalName);
if (nextLiteral == null || !platformAdapter.checkPermission(ctx, nextLiteral.permission()))
return new WalkResult.LiteralUnknown<>(ctx, literal, literalName);
literal = nextLiteral;
}