add /import to import closures from other QRs

This commit is contained in:
LenAnderson
2024-07-10 19:52:13 -04:00
parent 5df932a76d
commit 977d98e7e8
3 changed files with 115 additions and 0 deletions

View File

@ -861,6 +861,17 @@ export class SlashCommandParser {
} else if (typeof cmd.unnamedArgumentList[0]?.value == 'string') {
this.scope.variableNames.push(cmd.unnamedArgumentList[0].value);
}
} else if (cmd.name == 'import') {
const value = /**@type {string[]}*/(cmd.unnamedArgumentList.map(it=>it.value));
for (let i = 0; i < value.length; i++) {
const srcName = value[i];
let dstName = srcName;
if (i + 2 < value.length && value[i + 1] == 'as') {
dstName = value[i + 2];
i += 2;
}
this.scope.variableNames.push(dstName);
}
}
}
if (this.testCommandEnd()) {