From 3cf9398bde80537ab6767fcd5c688ccda9d019ff Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 15 Feb 2021 00:10:53 -0600 Subject: [PATCH] js: Check that script is marked as yielding when using procedure that yields --- src/compiler/jsgen.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/jsgen.js b/src/compiler/jsgen.js index 757f0fca..8ccdcd91 100644 --- a/src/compiler/jsgen.js +++ b/src/compiler/jsgen.js @@ -893,6 +893,9 @@ class JSGenerator { } if (procedureData.yields) { this.source += 'yield* '; + if (!this.script.yields) { + throw new Error('Script uses yielding procedure but is not marked as yielding.'); + } } this.source += `thread.procedures["${sanitize(procedureCode)}"](`; // Only include arguments if the procedure accepts any.