refactor
This commit is contained in:
parent
cfd4d7c57b
commit
bca3602da2
|
@ -59,7 +59,7 @@ import { isSeparatorNeeded, getSeparatorInfo } from '@/utility/timeline-date-sep
|
|||
import { Paginator } from '@/utility/paginator.js';
|
||||
|
||||
const props = defineProps<{
|
||||
excludeTypes?: typeof notificationTypes[number][];
|
||||
excludeTypes?: typeof notificationTypes[number][] | null;
|
||||
}>();
|
||||
|
||||
const rootEl = useTemplateRef('rootEl');
|
||||
|
|
|
@ -196,13 +196,13 @@ async function run() {
|
|||
|
||||
const isLegacy = !flash.value.script.replaceAll(' ', '').startsWith('///@1.0.0');
|
||||
|
||||
const { Interpreter, Parser, values } = isLegacy ? await import('@syuilo/aiscript-0-19-0') : await import('@syuilo/aiscript');
|
||||
const { Interpreter, Parser, values } = isLegacy ? (await import('@syuilo/aiscript-0-19-0') as any) : await import('@syuilo/aiscript');
|
||||
|
||||
const parser = new Parser();
|
||||
|
||||
components.value = [];
|
||||
|
||||
aiscript.value = new Interpreter({
|
||||
const interpreter = new Interpreter({
|
||||
...createAiScriptEnv({
|
||||
storageKey: 'flash:' + flash.value.id,
|
||||
}),
|
||||
|
@ -221,6 +221,8 @@ async function run() {
|
|||
},
|
||||
});
|
||||
|
||||
aiscript.value = interpreter;
|
||||
|
||||
let ast;
|
||||
try {
|
||||
ast = parser.parse(flash.value.script);
|
||||
|
@ -232,8 +234,8 @@ async function run() {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
await aiscript.value.exec(ast);
|
||||
} catch (err) {
|
||||
await interpreter.exec(ast);
|
||||
} catch (err: any) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
title: 'AiScript Error',
|
||||
|
|
Loading…
Reference in New Issue