Skip to content

Disallow block type names that might match anything in Blockly.Generator.prototype #1558

Description

@AnmAtAnm

Problem statement

We currently define block generators as:

Blockly.JavaScript['asdf'] = function(block) {
  // TODO: Assemble JavaScript into code variable.
  var code = '...;\n';
  return code;
};

However, Blockly.JavaScript (and all other built in language implementations) are object instances of Blockly.Generator with existing fields and methods. That means the following should be considered invalid block type names:

"INFINITE_LOOP_TRAP", "STATEMENT_PREFIX", "INDENT", "COMMENT_WRAP",
"ORDER_OVERRIDES", "workspaceToCode", "prefixLines", "allNestedComments", "blockToCode",
"valueToCode", "statementToCode", "addLoopTrap", "RESERVED_WORDS_", "addReservedWords",
"FUNCTION_NAME_PLACEHOLDER_", "provideFunction_", "init", "scrub_", "finish",
"scrubNakedValue"

Assigning any of these may corrupt generator behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions