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