Skip to content

Duplicate argument names when copy pasting argument blocks #9865

@LappiLappland

Description

@LappiLappland

Check for duplicates

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

Description

You can copy argument blocks in procedures mutator workspace. This is intentional behaviour and even has a special check for pasting

However, currently procedures_mutatorarg validator returns null after pasting such block which supposedely should reset it to the previous valid state, but for pasted blocks previous state is actually invalid

You may end up with duplicate argument blocks inside function, which can raise exception during code generation Duplicate parameter name not allowed in this context and lead to generation of invalid code

Reproduction steps

  1. Create procedure definition block
  2. Open arguments editing mutator workspace
  3. Insert argument block
  4. Hit copy hotkey and then paste hotkey
  5. Insert duplicate block in arguments

Priority

You can accidentally break code generation, but it can be manually fixed too

Stack trace

Uncaught SyntaxError: Duplicate parameter name not allowed in this context
    at runCode (index.js:38:1)
    at eval (index.js:65:1)
    at WorkspaceSvg$$module$build$src$core$workspace_svg.fireChangeListener (blockly_compressed.js:1346:89)
    at fireNow$$module$build$src$core$events$utils (blockly_compressed.js:87:337)

Screenshots

arguments.bug.mp4

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugDescribes why the code or behaviour is wrongissue: triageIssues awaiting triage by a Blockly team member

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions