Skip to content

Custom code generation using statementToCode stops after first disabled block. #9372

@stefan-stanca

Description

@stefan-stanca

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

We've recently upgraded from v10x to v12.3.0 and noticed strange behavior with our json generation logic. Our json generator for procedures_defreturn uses the following:
const branch = generator.statementToCode(block, "STACK");

statementToCode no longer continues after it encounters a disabled statement and it ignores any enabled statements that come after that. I could not find anything in the release notice documenting this change. Below is a simple example to replicate the issue:

Image
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="st;R3Gv?hZO%gen/D,DD\">test</variable></variables><block type="procedures_defreturn" id="X9dKT|eT3]ebKyUClC6f" deletable="false" editable="false" x="350" y="150"><field name="NAME">test</field><comment pinned="false" h="80" w="160">Describe this function...</comment><statement name="STACK"><block type="controls_if" id="0`5}e{BBT{nYvzo}ORJW" disabled-reasons="user%20action"><next><block type="variables_set_dynamic" id="^^vGa8uiHh`4*49qXGhL"><field name="VAR" id="st;R3Gv?hZO%gen/D,DD">test</field><value name="VALUE"><block type="text" id="^(nef#JuKjwP7*wW-d%("><field name="TEXT"></field></block></value></block></next></block></statement><value name="RETURN"><block type="text" id="(krxy}_(hXRVy8%f8.^g"><field name="TEXT"></field></block></value></block></xml>

Reproduction steps

  1. Create a workspace with a procedures_defreturn block and define a custom json generator, add 2 statements and disable the first.
  2. Call generator.statementToCode(block, "STACK"); in the json generator.
  3. Notice the second statement is ommited from the final output.

Stack trace

Screenshots

No response

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    carryoverissue: bugDescribes why the code or behaviour is wrong

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions