add /break value
This commit is contained in:
parent
8e90e2a0e4
commit
6193b6590e
|
@ -1,3 +1,7 @@
|
||||||
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
|
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
|
||||||
|
|
||||||
export class SlashCommandBreak extends SlashCommandExecutor {}
|
export class SlashCommandBreak extends SlashCommandExecutor {
|
||||||
|
get value() {
|
||||||
|
return this.unnamedArgumentList[0]?.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -218,6 +218,7 @@ export class SlashCommandClosure {
|
||||||
console.log('encountered SlashCommandBreak');
|
console.log('encountered SlashCommandBreak');
|
||||||
if (this.breakController) {
|
if (this.breakController) {
|
||||||
this.breakController?.break();
|
this.breakController?.break();
|
||||||
|
this.scope.pipe = step.value.value ?? this.scope.pipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (!step.done && this.debugController?.testStepping(this)) {
|
} else if (!step.done && this.debugController?.testStepping(this)) {
|
||||||
|
@ -260,6 +261,7 @@ export class SlashCommandClosure {
|
||||||
yield executor;
|
yield executor;
|
||||||
} else if (executor instanceof SlashCommandBreak) {
|
} else if (executor instanceof SlashCommandBreak) {
|
||||||
done += this.executorList.length - this.executorList.indexOf(executor);
|
done += this.executorList.length - this.executorList.indexOf(executor);
|
||||||
|
this.scope.pipe = executor.value ?? this.scope.pipe;
|
||||||
yield executor;
|
yield executor;
|
||||||
} else {
|
} else {
|
||||||
/**@type {import('./SlashCommand.js').NamedArguments} */
|
/**@type {import('./SlashCommand.js').NamedArguments} */
|
||||||
|
|
|
@ -727,6 +727,10 @@ export class SlashCommandParser {
|
||||||
cmd.command = this.commands['break'];
|
cmd.command = this.commands['break'];
|
||||||
cmd.start = this.index + 1;
|
cmd.start = this.index + 1;
|
||||||
this.take('/break'.length);
|
this.take('/break'.length);
|
||||||
|
this.discardWhitespace();
|
||||||
|
if (this.testUnnamedArgument()) {
|
||||||
|
cmd.unnamedArgumentList.push(...this.parseUnnamedArgument());
|
||||||
|
}
|
||||||
cmd.end = this.index;
|
cmd.end = this.index;
|
||||||
this.commandIndex.push(cmd);
|
this.commandIndex.push(cmd);
|
||||||
this.scopeIndex.push(this.scope.getCopy());
|
this.scopeIndex.push(this.scope.getCopy());
|
||||||
|
|
Loading…
Reference in New Issue