Skip to main content

Home > blockly > CodeGenerator > scrub_

CodeGenerator.scrub_() method

Common tasks for generating code from blocks. This is called from blockToCode and is called on every block, not just top level blocks. Subclasses may override this, e.g. to generate code for statements following the block, or to handle comments for the specified block and any connected value blocks.

Signature:

scrub_(_block: Block, code: string, _opt_thisOnly?: boolean): string;

Parameters

ParameterTypeDescription
_blockBlockThe current block.
codestringThe code created for this block.
_opt_thisOnlyboolean(Optional) True to generate code for only this statement.

Returns:

string

Code with comments and subsequent blocks added.