js+ir: check whether thread status after running addon block
Fixes "breakpoint" block working unreliably
This commit is contained in:
3 files changed
+7
-2
No files matched your search
@@ -1120,6 +1120,7 @@ class ScriptTreeGenerator {
|
||||
|
||||
const addonBlock = this.runtime.getAddonBlock(procedureCode);
|
||||
if (addonBlock) {
|
||||
this.script.yields = true;
|
||||
const args = {};
|
||||
for (let i = 0; i < paramIds.length; i++) {
|
||||
let value;
|
||||
|
||||
@@ -203,7 +203,7 @@ const executeInCompatibilityLayer = function*(inputs, blockFunction, useFlags) {
|
||||
* @param {string} blockId The ID of the block being run
|
||||
* @param {object} args The arguments to pass to the block
|
||||
*/
|
||||
const callAddonBlock = (procedureCode, blockId, args) => {
|
||||
const callAddonBlock = function*(procedureCode, blockId, args) {
|
||||
const addonBlock = thread.target.runtime.getAddonBlock(procedureCode);
|
||||
if (addonBlock) {
|
||||
const target = thread.target;
|
||||
@@ -214,6 +214,9 @@ const callAddonBlock = (procedureCode, blockId, args) => {
|
||||
},
|
||||
target
|
||||
});
|
||||
if (thread.status === Thread.STATUS_PROMISE_WAIT) {
|
||||
yield;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -658,7 +658,8 @@ class JSGenerator {
|
||||
descendStackedBlock (node) {
|
||||
switch (node.kind) {
|
||||
case 'addons.call':
|
||||
this.source += `callAddonBlock("${sanitize(node.code)}","${sanitize(node.blockId)}",{`;
|
||||
this.source += `yield* callAddonBlock("${sanitize(node.code)}","${sanitize(node.blockId)}",{`;
|
||||
this.yielded();
|
||||
for (const argumentName of Object.keys(node.arguments)) {
|
||||
const argumentValue = node.arguments[argumentName];
|
||||
this.source += `"${sanitize(argumentName)}":${this.descendInput(argumentValue).asSafe()},`;
|
||||
|
||||
Reference in new issue
Block a user