patterns can now be async

This commit is contained in:
Felix Roos 2022-02-27 20:08:56 +01:00
parent 634d4f1099
commit 4f2f00ee62
5 changed files with 45 additions and 11 deletions

View file

@ -29,10 +29,10 @@ hackLiteral(String, ['pure', 'p'], bootstrapped.pure); // comment out this line
// this will add everything to global scope, which is accessed by eval
Object.assign(globalThis, bootstrapped, Tone, toneHelpers);
export const evaluate: any = (code: string) => {
export const evaluate: any = async (code: string) => {
const shapeshifted = shapeshifter(code); // transform syntactically correct js code to semantically usable code
// console.log('shapeshifted', shapeshifted);
let evaluated = eval(shapeshifted);
let evaluated = await eval(shapeshifted);
if (typeof evaluated === 'function') {
evaluated = evaluated();
}